You are here

function properties_admin_categories_list in Dynamic properties 7

Menu callback; Display a list of categories.

1 string reference to 'properties_admin_categories_list'
properties_menu in ./properties.module
Implements hook_menu().

File

./properties.admin.inc, line 11
Contains admin menu callbacks for properties.module.

Code

function properties_admin_categories_list() {
  $header = array(
    array(
      'data' => t('Name'),
      'field' => 'name',
    ),
    array(
      'data' => t('Label'),
      'field' => 'label',
      'sort' => 'asc',
    ),
    t('Operations'),
  );
  $categories = properties_category_load_paging(20, array(
    'header' => $header,
  ));
  $rows = array();
  $url_options = array(
    'query' => drupal_get_destination(),
  );
  foreach ($categories as $category) {
    $links = array(
      l(t('edit'), 'admin/config/content/properties/categories/edit/' . $category->name, $url_options),
      l(t('delete'), 'admin/config/content/properties/categories/delete/' . $category->name, $url_options),
    );
    $rows[] = array(
      check_plain($category->name),
      check_plain($category->label),
      implode(' ', $links),
    );
  }
  $content['table'] = array(
    '#theme' => 'table',
    '#rows' => $rows,
    '#header' => $header,
    '#empty' => t('No categories found.'),
  );
  $content['pager']['#markup'] = theme('pager');
  return $content;
}