You are here

function search_api_page_admin_overview in Search API Pages 7

Displays an overview of all defined search pages.

1 string reference to 'search_api_page_admin_overview'
search_api_page_menu in ./search_api_page.module
Implements hook_menu().

File

./search_api_page.admin.inc, line 10
Admin page callbacks for the Search pages module.

Code

function search_api_page_admin_overview() {
  $base_path = drupal_get_path('module', 'search_api') . '/';
  drupal_add_css($base_path . 'search_api.admin.css');
  $header = array(
    t('Status'),
    t('Configuration'),
    t('Name'),
    t('Path'),
    t('Index'),
    t('Operations'),
  );
  $rows = array();
  $t_enabled['data'] = array(
    '#theme' => 'image',
    '#path' => $base_path . 'enabled.png',
    '#alt' => t('enabled'),
    '#title' => t('enabled'),
  );
  $t_enabled['class'] = array(
    'search-api-status',
  );
  $t_disabled['data'] = array(
    '#theme' => 'image',
    '#path' => $base_path . 'disabled.png',
    '#alt' => t('disabled'),
    '#title' => t('disabled'),
  );
  $t_disabled['class'] = array(
    'search-api-status',
  );
  $t_edit = t('edit');
  $pre = 'admin/config/search/search_api/page/';
  $pre_index = 'admin/config/search/search_api/index/';
  foreach (search_api_page_load_multiple() as $page) {
    $index = search_api_index_load($page->index_id);
    $rows[] = array(
      $page->enabled ? $t_enabled : $t_disabled,
      theme('entity_status', array(
        'status' => $page->status,
      )),
      l($page->name, $page->path),
      l($page->path, $page->path),
      l($index->name, $pre_index . $index->machine_name),
      l($t_edit, $pre . $page->machine_name),
    );
  }
  return array(
    '#theme' => 'table',
    '#header' => $header,
    '#rows' => $rows,
    '#empty' => t('There are no search pages defined yet.'),
  );
}