You are here

function properties_template_admin_templates_list in Dynamic properties 7

Menu callback; Display a list of templates

1 string reference to 'properties_template_admin_templates_list'
properties_template_menu in properties_template/properties_template.module
Implements hook_menu().

File

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

Code

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