You are here

function libraries_admin_library_status_form in Libraries API 7.2

Form generation callback for the status overview for a single library.

This is a form instead of a page to allow easier extending in contributed modules.

@todo Add some var_export($library)-style output

Parameters

array $form: An associative array containing the structure of the form.

array $form_state: A keyed array containing the current state of the form.

array $library: A library information array.

Return value

array|null The form array for the status form or NULL if the library was not found.

1 string reference to 'libraries_admin_library_status_form'
libraries_menu in ./libraries.module
Implements hook_menu().

File

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

Code

function libraries_admin_library_status_form(array $form, array &$form_state, $library) {
  drupal_set_title(t('Status report for library %library', array(
    '%library' => $library['name'],
  )), PASS_THROUGH);
  if ($library['installed']) {
    drupal_set_message(t('The %name library is installed correctly.', array(
      '%name' => $library['name'],
    )));
    $form['status'] = libraries_admin_status_table($library);
  }
  else {
    drupal_set_message($library['error message'], 'error');
    switch ($library['error']) {
      case 'not found':
        $form['instructions'] = libraries_admin_instructions_missing($library);
        break;
      case 'not detected':
        $form['instructions'] = libraries_admin_instructions_undetected($library);
        break;
      case 'not supported':
        $form['instructions'] = libraries_admin_instructions_unsupported($library);
        break;
      case 'missing dependency':
        $form['instructions']['instruction']['#markup'] = t('There is a missing dependency in your configuration that prevents this library from working properly.') . '<br>';
        break;
      case 'incompatible dependency':
        $form['instructions']['instruction']['#markup'] = t('There is an incompatible dependency in your configuration that prevents this library from working properly.') . '<br>';
        break;
    }
  }
  return $form;
}