You are here

function libraries_admin_instructions_unsupported in Libraries API 7.2

Returns instructions for dealing with an unsupported library.

Parameters

array $library: A library information array.

Return value

array A renderable array containing the instructions.

1 call to libraries_admin_instructions_unsupported()
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 364
Provides administrative page and form callbacks for Libraries module.

Code

function libraries_admin_instructions_unsupported($library) {
  $build = array();
  $items = array();

  // Either download a different version of the library...
  $versions = array_keys($library['versions']);
  usort($versions, 'version_compare');
  $versions = array_reverse($versions);
  $version = $versions[0];
  $build['instruction']['#markup'] = t('Please install version %version of the library by following the following steps:', array(
    '%version' => $version,
  ));

  // 1. Delete the old library.
  $items[] = t('Delete the entire contents of the %library-path directory.', array(
    '%library-path' => $library['library path'],
  ));

  // 2. Download the new library.
  $items[] = t('Download version %version of the library <a href="@download-url">here</a>.', array(
    '%version' => $version,
    '@download-url' => $library['download url'],
  ));

  // 3. 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.');

  // 4. Upload the new library.
  // 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 new files into the %library-path directory. The following files and directories should be contained in that directory: !directory-layout', array(
      '%library-path' => $library['library path'],
      '!directory-layout' => drupal_render($directory_layout),
    ));
  }
  else {
    $items[] = t('Upload the new files into the %library-path directory.', array(
      '%library-path' => $library['library path'],
    ));
  }

  // 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',
  );

  // ...or contact the maintainer of the library information.
  $provider = libraries_admin_get_provider($library);
  switch ($library['info type']) {
    case 'module':
      $build['contact']['#markup'] = t('If you are bound to version @version of the library, ask the maintainer of the %module module to provide support for it.', array(
        '@version' => $library['version'],
        '%module' => $provider,
      )) . '<br>';
      break;
    case 'theme':
      $build['contact']['#markup'] = t('If you are bound to version @version of the library, ask the maintainer of the %theme theme to provide support for it.', array(
        '@version' => $library['version'],
        '%theme' => $provider,
      )) . '<br>';
      break;
    case 'info file':
      $build['contact']['#markup'] = t('If you are bound to version @version of the library, ask the maintainer of the %info-file info file to provide support for it.', array(
        '@version' => $library['version'],
        '%info-file' => $provider,
      )) . '<br>';
      break;
  }
  return $build;
}