Back to SiteApplication class

Method getParams

public \Joomla\Registry\Registry
getParams
(mixed $option = null)
Get the application parameters
Parameters
  • string $option The component option
Returns
  • \Joomla\Registry\Registry The parameters object
Since
  • 3.2

Method getParams - Source code

/**
 * Get the application parameters
 *
 * @param   string  $option  The component option
 *
 * @return  Registry  The parameters object
 *
 * @since   3.2
 */
public function getParams($option = null)
{
    static $params = array();
    $hash = '__default';
    if (!empty($option)) {
        $hash = $option;
    }
    if (!isset($params[$hash])) {
        // Get component parameters
        if (!$option) {
            $option = $this->input->getCmd('option', null);
        }
        // Get new instance of component global parameters
        $params[$hash] = clone ComponentHelper::getParams($option);
        // Get menu parameters
        $menus = $this->getMenu();
        $menu = $menus->getActive();
        // Get language
        $lang_code = $this->getLanguage()->getTag();
        $languages = LanguageHelper::getLanguages('lang_code');
        $title = $this->get('sitename');
        if (isset($languages[$lang_code]) && $languages[$lang_code]->metadesc) {
            $description = $languages[$lang_code]->metadesc;
        } else {
            $description = $this->get('MetaDesc');
        }
        $rights = $this->get('MetaRights');
        $robots = $this->get('robots');
        // Retrieve com_menu global settings
        $temp = clone ComponentHelper::getParams('com_menus');
        // Lets cascade the parameters if we have menu item parameters
        if (\is_object($menu)) {
            // Get show_page_heading from com_menu global settings
            $params[$hash]->def('show_page_heading', $temp->get('show_page_heading'));
            $params[$hash]->merge($menu->getParams());
            $title = $menu->title;
        } else {
            // Merge com_menu global settings
            $params[$hash]->merge($temp);
            // If supplied, use page title
            $title = $temp->get('page_title', $title);
        }
        $params[$hash]->def('page_title', $title);
        $params[$hash]->def('page_description', $description);
        $params[$hash]->def('page_rights', $rights);
        $params[$hash]->def('robots', $robots);
    }
    return $params[$hash];
}