Goodmorning,
Is there the possibility to integrate SuiteCRM into iframe, limiting navigation within the CRM, for example by removing the sidebar on the left and the menu at the top?
So we would like to have an iframe that shows a particular entity (an Account, or Contact) and navigate only the entities connected.
Hhmm it might be difficult. But have a look at this:
Those are quite low-level settings that apply to every view in SuiteCRM. If you turn off those elements, then the page generation won’t output them.
You can find many examples of this being tweaked in several points in the code. For example, when there are AJAX calls, only a simple JSON output is desired, not a full HTML page. Or in other places the menus are turned off for some reason.
If you can build a complete solution please share it here when you’re finished!
Thank you for your reply, I tried to follow your tip, but if I set show_header = false, I lost the page shows informations without css. I think that is not the correct point to do this.
I found a point, into tpl, where I can insert my condition to show/hide ajaxHeader div in themes/SuiteP/tpls/header.tpl
but I’m not sure that is the correct way, and that all cases are cover
I would like hide sidebar and top navigation bar just when the page is show into my iframe (maybe using a custom parameter in the URL) in the other cases, the bars must show.
in your opinion is it possible to do into tpl? can it be a valid solution?
Thank you so much for your tip. Today l’ll try to implement this solution:
1: add a custom parameter into URL open into iframe
2: into displayHeader method, check if the parameter exists and if true, invoke my custom header.tpl instead the standard header.tpl.
I told if this solution is fine for me.
Thank you so much
B.
Hi @pgr,
My solution works at half.
It is ok, only for first page that will be visited. For example if I am into a contact detail, if I would like go to account, I loose my custom parameter and when arrive in the account detail, I unfortunately have the navigation bars.
I tried to use a global variable that I set with value = true, only if in the request I have my custom parameter. In the other cases I do nothing.
Maybe I’m not in the correct place to made this, but I don’t know.
Any suggestions?
Thank you
B
Hi @pgr!
I change my implementation and I opted for a javascript that check:
I add in /custom/themes/SuiteP/js/style.js file, follow code:
$(document).ready(function () {
try {
console.log('SuiteCRM is open into an IFrame: ', window.self !== window.top);
if (window.self !== window.top){
var element = document.getElementById('ajaxHeader');
element.parentNode.removeChild(element);
var mainContent = document.getElementById('bootstrap-container');
mainContent.setAttribute("margin",0);
mainContent.setAttribute("class","col-md-12");
document.getElementByTagName("footer").className = "collapsedSidebar";
}
} catch (e) {
console.log('SuiteCRM check open into an IFrame error');
}
});