You are here

function theme_pagerer_preset_list in Pagerer 7

Render a table with the presets lists.

Including links to edit and delete operations.

1 theme call to theme_pagerer_preset_list()
pagerer_settings_form in ./pagerer.admin.inc
Main Pagerer settings admin form.

File

./pagerer.admin.inc, line 70
Pagerer administration

Code

function theme_pagerer_preset_list() {
  $header = array(
    t('Preset name'),
    t('Preview'),
    array(
      'data' => t('Operations'),
      'colspan' => 2,
    ),
  );
  $rows = array();
  foreach (_pagerer_list_presets() as $key => $value) {
    $row = array();
    $row[] = l($key, _PAGERER_CONFIG_PATH . '/edit/' . $key);
    $row[] = array(
      'data' => theme('pagerer', array(
        'preset' => $key,
      )),
      'class' => array(
        'pagerer-admin-preset-preview',
      ),
    );
    $row[] = l(t('edit'), _PAGERER_CONFIG_PATH . '/edit/' . $key);
    $row[] = l(t('delete'), _PAGERER_CONFIG_PATH . '/delete/' . $key);
    $rows[] = $row;
  }
  if (empty($rows)) {
    $rows[] = array(
      array(
        'colspan' => 4,
        'data' => t('There are currently no presets. <a href="!url">Add a new one</a>.', array(
          '!url' => url(_PAGERER_CONFIG_PATH . '/add'),
        )),
      ),
    );
  }
  return theme('table', array(
    'header' => $header,
    'rows' => $rows,
    'attributes' => array(
      'class' => array(
        'pagerer-admin-preset-list',
      ),
    ),
  ));
}