Get the description text based off the library version.

Paramètres

string $library_name: Name of the library.

string $module_name: Name of the module that contains hook_libraries_info for this library.

Return value

array Description text and info array.

8 calls to advagg_get_version_description()
advagg_css_compress_admin_settings_form dans advagg_css_compress/advagg_css_compress.admin.inc
Form builder; Configure advagg settings.
advagg_css_compress_requirements dans advagg_css_compress/advagg_css_compress.install
Implements hook_requirements().
advagg_font_requirements dans advagg_font/advagg_font.install
Implements hook_requirements().
advagg_mod_admin_settings_form dans advagg_mod/advagg_mod.admin.inc
Form builder; Configure advagg settings.
advagg_mod_requirements dans advagg_mod/advagg_mod.install
Implements hook_requirements().

... See full list

Fichier

./advagg.module, line 6339

Code

function advagg_get_version_description($library_name, $module_name, $only_remote_ok = FALSE) {
    $t = get_t();
    // Get local and external library version numbers.
    $versions =& drupal_static(__FUNCTION__);
    if (!isset($versions)) {
        $versions = advagg_get_remote_libraries_versions(TRUE);
    }
    $description = '';
    if (!empty($versions[$library_name]['remote']) && (empty($versions[$library_name]['local']) || $versions[$library_name]['local'] !== $versions[$library_name]['remote'])) {
        $library = advagg_get_library($library_name, $module_name);
        if (empty($versions[$library_name]['local'])) {
            $versions[$library_name]['local'] = 'NULL';
        }
        if (!empty($library['installed'])) {
            $description = $t('Go to the <a href="@url-page">@name</a> page and <a href="@url-zip">download</a> the latest version (@remote) into the @lib_path folder. An example valid filename is %version_file. Current Version: %version.', array(
                '@name' => $library['name'],
                '@lib_path' => $library['library path'],
                '@url-page' => $library['vendor url'],
                '@url-zip' => $library['download url'],
                '@remote' => $versions[$library_name]['remote'],
                '%version' => $versions[$library_name]['local'],
                '%version_file' => $library['library path'] . '/' . $library['version arguments']['file'],
            ));
        }
        elseif (!$only_remote_ok && is_callable('libraries_load')) {
            $description = $t('Go to the <a href="@url-page">@name</a> page and <a href="@url-zip">download</a> the latest version (@remote) into the libraries folder (usually sites/all/libraries). An example valid filename is %version_file.', array(
                '@name' => $library['name'],
                '@url-page' => $library['vendor url'],
                '@url-zip' => $library['download url'],
                '@remote' => $versions[$library_name]['remote'],
                '%version_file' => "sites/all/libraries/{$library_name}/{$library['version arguments']['file']}",
            ));
        }
        elseif (!$only_remote_ok) {
            $description = $t('Install the <a href="@url-lib-api">Libraries API</a> module and then go to the <a href="@url-page">@name</a> page and <a href="@url-zip">download</a> the latest version (@remote) into the libraries folder (usually sites/all/libraries). An example valid filename is %version_file.', array(
                '@name' => $library['name'],
                '@url-page' => $library['vendor url'],
                '@url-zip' => $library['download url'],
                '@remote' => $versions[$library_name]['remote'],
                '%version_file' => "sites/all/libraries/{$library_name}/{$library['version arguments']['file']}",
                '@url-lib-api' => 'https://www.drupal.org/project/libraries',
            ));
        }
    }
    $path = drupal_get_path('module', $module_name);
    $info = drupal_parse_info_file("{$path}/{$module_name}.info");
    // Check if library was unzipped with -master.
    if (!empty($description) && is_callable('libraries_get_libraries')) {
        $libraries_paths = libraries_get_libraries();
        if (!empty($libraries_paths["{$library_name}-master"])) {
            $description = $t('Rename @lib_dir_master to @lib_dir at this location: @lib_path_master.', array(
                '@lib_dir_master' => "{$library_name}-master",
                '@lib_path_master' => $libraries_paths["{$library_name}-master"],
                '@lib_dir' => $library_name,
            ));
        }
    }
    return array(
        $description,
        $info,
    );
}