esedic
4/10/2019 - 6:45 PM

Get Joomla menu custom params (content plugin)

Get Joomla menu custom params (content plugin)

<?php 

  $app = Factory::getApplication();
  $currentMenuItem = $app->getMenu()->getActive();
  $customattr = '';

  // we want to do something, when we are on pages with itemid 146 or 147
  if($currentMenuItem->id == '146' || $currentMenuItem->id == '147') {

    // we get data from menu with itemid 167
    $dejavnostItemId = $app->getMenu()->getItem(167);
  
    // customattr is field name of parameter, which was set with content plugin
    $customattr = $dejavnostItemId->params['customattr'];

  }

?>