You are here

function libraries_admin_instructions_missing in Libraries API 7.2

Returns instructions for dealing with a missing library.

Parameters

array $library: A library information array.

Return value

array A renderable array containing the instructions.

1 call to libraries_admin_instructions_missing()
libraries_admin_library_status_form in ./libraries.admin.inc
Form generation callback for the status overview for a single library.

File

./libraries.admin.inc, line 239
Provides administrative page and form callbacks for Libraries module.

Code

function libraries_admin_instructions_missing(array $library) {
  $build = array();
  $build['instruction']['#markup'] = t('Follow these steps to install the library:');
  $items = array();

  // 1. Download the library.
  // If no supported versions are specified, the latest version is
  // recommended.
  if (empty($library['versions'])) {
    $items[] = t('Download the latest version of the library <a href="@download-url">here</a>.', array(
      '@download-url' => $library['download url'],
    ));
  }
  else {
    $versions = array_keys($library['versions']);
    usort($versions, 'version_compare');
    $versions = array_reverse($versions);
    $version = $versions[0];
    $items[] = t('Download version %version of the library <a href="@download-url">here</a>.', array(
      '%version' => $version,
      '@download-url' => $library['download url'],
    ));
  }

  // 2. Unpack it.
  $items[] = t('If the library is an archive, i.e. if the file ending is for example <em>.tar.gz</em> or <em>.zip</em>, unpack it.');

  // 3. Create the libraries folder.
  $items[] = t('In the %library-directory directory of your Drupal installation create a %library directory.', array(
    '%library-directory' => 'sites/all/libraries',
    '%library' => $library['machine name'],
  ));

  // 4. Upload it.
  // If the library has variant-independent files, give the user the
  // location of an example file to check his filesystem against.
  if ($directory_layout = libraries_admin_directory_layout($library)) {
    $items[] = t('Upload the whole library (which can consist of multiple directories) into the newly created %library-path directory. The following files and directories should be contained in that directory: !directory-layout', array(
      '%library-path' => 'sites/all/libraries/' . $library['machine name'],
      '!directory-layout' => drupal_render($directory_layout),
    ));
  }
  else {
    $items[] = t('Upload the whole library (which can consist of multiple directories) into the newly created %library-path directory.', array(
      '%library-path' => 'sites/all/libraries/' . $library['machine name'],
    ));
  }

  // 5. Reload.
  $items[] = t('<a href="">Reload</a> the page. If successful, you should see status information about this library.');
  $build['steps'] = array(
    '#theme' => 'item_list',
    '#items' => $items,
    '#type' => 'ol',
  );
  return $build;
}