You are here

function styles_ui_containers_overview in Styles 6.2

Same name and namespace in other branches
  1. 6 contrib/styles_ui/includes/styles_ui.admin.inc \styles_ui_containers_overview()
  2. 7.2 contrib/styles_ui/styles_ui.admin.inc \styles_ui_containers_overview()
  3. 7 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'
xstyles_ui_menu in contrib/styles_ui/styles_ui.module
Implementation of hook_menu().

File

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

Code

function styles_ui_containers_overview($field_type = NULL) {
  $presets = styles_default_presets();
  if (isset($field_type) && $presets['$field_type']) {
    $presets = $presets[$field_type];
  }
  $styles_containers = styles_default_containers();
  $field_containers = $styles_containers[$field_type];
  $field_types = _content_field_types();
  $field_label = $field_types[$field_type]['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';
  return theme('table', $header, $rows);
  $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;
}