You need to be logged in to post in the forum - Log In
An active JCE Pro Subscription is required to post in the forum - Buy a Subscription
- Support
- Forum
- MediaBox
- JCE Plugins / Addons
- HELP: Need Custom Plugin to ONLY appear on Preview Tab
I have some custom joomla plugins that make use of 'shortcodes'. I can't get them to work on the preview tab. It's because the following code is in the plugin:
$app = JFactory::getApplication();
if( $app->isAdmin()) {
return false;
}
$layout = JRequest::getString('layout');
if($layout == "edit" ) {
return false;
}
I can't remove the code, because it's necessary in order to put the 'shortcodes' in the editor.
What code do I need to add to make the plugin work in the preview tab and ONLY the preview tab (backend and front end)? I'd prefer a PHP solution, but I'd be OK with replicating the shortcode script in JS as well.
I tried the following, but it didn't work:
if( $layout == "edit" && JRequest::getCmd('option') === "com_jce" && JRequest::getWord('plugin') === "preview" ){
return true;
}
THANK YOU!!!
$app = JFactory::getApplication();
if( $app->isAdmin()) {
return false;
}
$layout = JRequest::getString('layout');
if($layout == "edit" ) {
return false;
}
I can't remove the code, because it's necessary in order to put the 'shortcodes' in the editor.
What code do I need to add to make the plugin work in the preview tab and ONLY the preview tab (backend and front end)? I'd prefer a PHP solution, but I'd be OK with replicating the shortcode script in JS as well.
I tried the following, but it didn't work:
if( $layout == "edit" && JRequest::getCmd('option') === "com_jce" && JRequest::getWord('plugin') === "preview" ){
return true;
}
THANK YOU!!!
Try this:
$isJCEPreview = JRequest::getCmd('option') === "com_jce" && JRequest::getWord('plugin') === "preview";
if (!$isJCEPreview) {
if( $app->isAdmin()) {
return false;
}
if (JRequest::getString('layout') == "edit" ) {
return false;
}
}
// rest of plugin code...
Just because you're not paranoid doesn't mean everybody isn't out to get you.
Thank you for getting back with me
It's not working. When I echo the statements,
I get the following output:
imgmanager_extcom_content
Is this because they're system plugins and not a content plugins?
I may be able to change a couple to content plugins, but not all.
Thoughts??!!!
It's not working. When I echo the statements,
$isJCEPreview = JRequest::getWord('plugin');
$test2 = JRequest::getCmd('option');
echo $isJCEPreview;
echo $test2;
I get the following output:
imgmanager_extcom_content
Is this because they're system plugins and not a content plugins?
I may be able to change a couple to content plugins, but not all.
Thoughts??!!!
Preview content is only processed via the "onPrepareContent" method, and only in Content plugins, so this method must be present in your content plugin, eg:
public function onPrepareContent(&$article, &$params, $limitstart = 0)
{
}
Just because you're not paranoid doesn't mean everybody isn't out to get you.
- Page :
- 1
There are no replies made for this post yet.
Be one of the first to reply to this post!
Be one of the first to reply to this post!