Back to Associations class

Method isEnabled

public static bool
isEnabled
()
Method to determine if the language filter Associations parameter is enabled.
Returns
  • bool True if the parameter is implemented; false otherwise.
Since
  • 3.2
Class: Associations
Project: Joomla

Method isEnabled - Source code

/**
 * Method to determine if the language filter Associations parameter is enabled.
 * This works for both site and administrator.
 *
 * @return  boolean  True if the parameter is implemented; false otherwise.
 *
 * @since   3.2
 */
public static function isEnabled()
{
    // Flag to avoid doing multiple database queries.
    static $tested = false;
    // Status of language filter parameter.
    static $enabled = false;
    if (Multilanguage::isEnabled()) {
        // If already tested, don't test again.
        if (!$tested) {
            $plugin = PluginHelper::getPlugin('system', 'languagefilter');
            if (!empty($plugin)) {
                $params = new Registry($plugin->params);
                $enabled = (bool) $params->get('item_associations', true);
            }
            $tested = true;
        }
    }
    return $enabled;
}