You are here

function theme_simplemeta_meta_list in Simple Meta 7

Same name and namespace in other branches
  1. 6.2 simplemeta.theme.inc \theme_simplemeta_meta_list()

Output list of saved SimpleMeta configurations.

1 theme call to theme_simplemeta_meta_list()
simplemeta_meta_list in ./simplemeta.admin.inc
Menu callback; show list of saved SimpleMeta configurations.

File

./simplemeta.theme.inc, line 11
Theming

Code

function theme_simplemeta_meta_list($vars) {
  $items = $vars['items'];
  $header = array(
    t('Path'),
    t('Alias'),
  );
  $language_enabled = variable_get('simplemeta_language_enable', FALSE);
  if ($language_enabled) {
    $header[] = t('Language');
  }
  $header[] = t('Action');
  $rows = array();
  foreach ($items as $meta) {
    $row = array();

    // @todo think about how to determine that path is pattern, like node/%/edit
    $pattern = strpos($meta->path, '%') !== FALSE;
    $alias = drupal_get_path_alias($meta->path);
    $row[] = !$pattern ? l($meta->path, $meta->path) : check_plain($meta->path);
    $row[] = !$pattern && $alias != $meta->path ? l($alias, $meta->path) : '-';
    if ($language_enabled) {

      // Langcode... there is no need to sanitize it.
      $row[] = $meta->language ? $meta->language : '-';
    }
    $row[] = l(t('Edit'), 'admin/content/simplemeta/' . $meta->sid . '/edit') . ' | ' . l(t('Delete'), 'admin/content/simplemeta/' . $meta->sid . '/delete');
    $rows[] = $row;
  }
  if (empty($rows)) {
    $rows[] = array(
      array(
        'data' => t('There is no saved meta data'),
        'colspan' => count($header),
      ),
    );
  }
  return theme('table', array(
    'header' => $header,
    'rows' => $rows,
  ));
}