Back to LibraryHelper class

Method getLibrary

public static \stdClass
getLibrary
(mixed $element, mixed $strict = false)
Get the library information.
Parameters
  • string $element Element of the library in the extensions table.
  • bool $strict If set and the library does not exist, the enabled attribute will be set to false.
Returns
  • \stdClass An object with the library's information.
Since
  • 3.2
Class: LibraryHelper
Project: Joomla

Method getLibrary - Source code

/**
 * Get the library information.
 *
 * @param   string   $element  Element of the library in the extensions table.
 * @param   boolean  $strict   If set and the library does not exist, the enabled attribute will be set to false.
 *
 * @return  \stdClass   An object with the library's information.
 *
 * @since   3.2
 */
public static function getLibrary($element, $strict = false)
{
    // Is already cached?
    if (isset(static::$libraries[$element]) || static::loadLibrary($element)) {
        $result = static::$libraries[$element];
        // Convert the params to an object.
        if (\is_string($result->params)) {
            $result->params = new Registry($result->params);
        }
    } else {
        $result = new \stdClass();
        $result->enabled = $strict ? false : true;
        $result->params = new Registry();
    }
    return $result;
}