Back to Dropdown class

Method addCustomItem

public static void
addCustomItem
(mixed $label, mixed $link = 'javascript:void(0)', mixed $linkAttributes = '', mixed $className = '', mixed $ajaxLoad = false, mixed $jsCallBackFunc = null)
Append a custom item to current dropdown menu
Parameters
  • string $label The label of item
  • string $link The link of item
  • string $linkAttributes Custom link attributes
  • string $className Class name of item
  • bool $ajaxLoad True if using ajax load when item clicked
  • string $jsCallBackFunc Javascript function name, called when ajax load successfully
Returns
  • void
Since
  • 3.0
Class: Dropdown
Project: Joomla

Method addCustomItem - Source code

/**
 * Append a custom item to current dropdown menu
 *
 * @param   string   $label           The label of item
 * @param   string   $link            The link of item
 * @param   string   $linkAttributes  Custom link attributes
 * @param   string   $className       Class name of item
 * @param   boolean  $ajaxLoad        True if using ajax load when item clicked
 * @param   string   $jsCallBackFunc  Javascript function name, called when ajax load successfully
 *
 * @return  void
 *
 * @since   3.0
 */
public static function addCustomItem($label, $link = 'javascript:void(0)', $linkAttributes = '', $className = '', $ajaxLoad = false, $jsCallBackFunc = null)
{
    static::start();
    if ($ajaxLoad) {
        $href = ' href = "javascript:void(0)" onclick="loadAjax(\'' . $link . '\', \'' . $jsCallBackFunc . '\')"';
    } else {
        $href = ' href = "' . $link . '" ';
    }
    $dropDownList = static::$dropDownList;
    $dropDownList .= '<li class="' . $className . '"><a ' . $linkAttributes . $href . ' >';
    $dropDownList .= $label;
    $dropDownList .= '</a></li>';
    static::$dropDownList = $dropDownList;
}