Skip to main content
Corrected Errors
Source Link
Eoin
  • 2k
  • 1
  • 15
  • 37

I thought about this and I came up with a different solution. Assuming your plugin has a field called "class" in the XML.

$app = JFactory::getApplication();
$appParams = $app->getParams();
        
$class = "";
if ($this->params['class'])
{
    $class = $this->params['class'];
}
        
$pageClass = $appParams['pageclass_sfx']$appParams['pageclass_sfx'];
if(!empty($pageClass)) 
{
    $class = " " . $this->params['class'];
}
else 
{
    $class = $this->params['class'];
}
$pageClass = $pageClass . $class;
$app->setParams($pageClass);

As the menu/page class is already added to the body we can just concatenate ur new class

I thought about this and I came up with a different solution. Assuming your plugin has a field called "class" in the XML.

$app = JFactory::getApplication();
$appParams = $app->getParams();
        
$class = "";
if ($this->params['class'])
{
    $class = $this->params['class'];
}
        
$pageClass = $appParams['pageclass_sfx']
if(!empty($pageClass)) 
{
    $class = " " . $this->params['class'];
}
else 
{
    $class = $this->params['class'];
}

As the menu/page class is already added to the body we can just concatenate ur new class

I thought about this and I came up with a different solution. Assuming your plugin has a field called "class" in the XML.

$app = JFactory::getApplication();
$appParams = $app->getParams();
        
$class = "";
if ($this->params['class'])
{
    $class = $this->params['class'];
}
        
$pageClass = $appParams['pageclass_sfx'];
if(!empty($pageClass)) 
{
    $class = " " . $this->params['class'];
}
else 
{
    $class = $this->params['class'];
}
$pageClass = $pageClass . $class;
$app->setParams($pageClass);

As the menu/page class is already added to the body we can just concatenate ur new class

Source Link
Eoin
  • 2k
  • 1
  • 15
  • 37

I thought about this and I came up with a different solution. Assuming your plugin has a field called "class" in the XML.

$app = JFactory::getApplication();
$appParams = $app->getParams();
        
$class = "";
if ($this->params['class'])
{
    $class = $this->params['class'];
}
        
$pageClass = $appParams['pageclass_sfx']
if(!empty($pageClass)) 
{
    $class = " " . $this->params['class'];
}
else 
{
    $class = $this->params['class'];
}

As the menu/page class is already added to the body we can just concatenate ur new class