Back to LanguageHelper class

Method getMetadata

public static mixed
getMetadata
(mixed $lang)
Returns an associative array holding the metadata.
Parameters
  • string $lang The name of the language.
Returns
  • mixed If $lang exists return key/value pair with the language metadata, otherwise return NULL.
Since
  • 3.7.0

Method getMetadata - Source code

/**
 * Returns an associative array holding the metadata.
 *
 * @param   string  $lang  The name of the language.
 *
 * @return  mixed  If $lang exists return key/value pair with the language metadata, otherwise return NULL.
 *
 * @since   3.7.0
 */
public static function getMetadata($lang)
{
    $file = self::getLanguagePath(JPATH_BASE, $lang) . '/langmetadata.xml';
    if (!is_file($file)) {
        $file = self::getLanguagePath(JPATH_BASE, $lang) . '/' . $lang . '.xml';
    }
    $result = null;
    if (is_file($file)) {
        $result = self::parseXMLLanguageFile($file);
    }
    if (empty($result)) {
        return;
    }
    return $result;
}