You are here

function styles_ui_containers_overview in Styles 7

Same name and namespace in other branches
  1. 6.2 contrib/styles_ui/includes/styles_ui.admin.inc \styles_ui_containers_overview()
  2. 6 contrib/styles_ui/includes/styles_ui.admin.inc \styles_ui_containers_overview()
  3. 7.2 contrib/styles_ui/styles_ui.admin.inc \styles_ui_containers_overview()

Page callback for various styles preset overview listing pages.

1 string reference to 'styles_ui_containers_overview'
styles_ui_menu in contrib/styles_ui/styles_ui.module
Implements hook_menu().

File

contrib/styles_ui/styles_ui.admin.inc, line 11
Administrative page callbacks for the Styles UI module.

Code

function styles_ui_containers_overview($field_type) {
  $presets = styles_presets();
  $presets = $presets[$field_type];
  $styles_containers = styles_containers();
  $field_containers = $styles_containers[$field_type];
  $field_info = field_info_field_types($field_type);
  $field_label = $field_info['label'];
  $header = array(
    t('Presets'),
    array(
      'data' => t('Operations'),
      'colspan' => 2,
    ),
  );
  $rows = array();
  foreach ($presets as $key => $preset) {
    $row = array(
      theme('styles_ui_admin_overview', array(
        'preset_name' => $key,
      )),
    );
    $row[] = array(
      'data' => l(t('edit'), $field_containers['admin']['path'] . '/edit/' . $key),
    );
    $row[] = array(
      'data' => l(t('delete'), $field_containers['admin']['path'] . '/delete/' . $key),
    );
    $rows[] = $row;
  }
  $title = 'Add ' . $field_label . ' style preset';
  $build['styles_table'] = array(
    '#theme' => 'table',
    '#header' => $header,
    '#rows' => $rows,
    '#empty' => t('No styles available. <a href="@link">@add</a>.', array(
      '@add' => t($title),
      '@link' => url($field_containers['admin']['path'] . '/add'),
    )),
  );
  return $build;
}