You are here

function metatag_context_context_overview in Metatag 7

Provides administration overview page for metatags by path settings.

1 string reference to 'metatag_context_context_overview'
metatag_context_menu in metatag_context/metatag_context.module
Implements hook_menu().

File

metatag_context/metatag_context.admin.inc, line 11
Admin settings page for Metatag Context.

Code

function metatag_context_context_overview() {
  $contexts = context_enabled_contexts(TRUE);
  $header = array(
    t('Name'),
    t('Paths'),
    t('Weight'),
    t('Operations'),
  );
  $rows = array();
  $caption = t('Values assigned here inherit from the <a href="@url" title="Edit the global default meta tags.">global defaults</a>. Use the weight to specify the order the context meta tags run.', array(
    '@url' => url('admin/config/search/metatags/config/global'),
  ));
  foreach ($contexts as $name => $context) {

    // Only show context items that are specifically selected to be "Shown on
    // metatag admin page".
    if (isset($context->reactions['metatag_context_reaction']['metatag_admin']) && $context->reactions['metatag_context_reaction']['metatag_admin']) {
      $ops = array(
        l(t('Edit'), 'admin/config/search/metatags/context/' . $context->name, array(
          'query' => array(
            'destination' => 'admin/config/search/metatags/context',
          ),
        )),
        l(t('Delete'), 'admin/config/search/metatags/context/' . $context->name . '/delete', array(
          'query' => array(
            'destination' => 'admin/config/search/metatags/context',
          ),
        )),
      );
      $rows[] = array(
        'name' => $context->name,
        'path' => isset($context->conditions['path']) ? htmlspecialchars(implode(', ', $context->conditions['path']['values'])) : t('No path condition.'),
        'weight' => isset($context->reactions['metatag_context_reaction']['weight']) ? $context->reactions['metatag_context_reaction']['weight'] : 0,
        'ops' => implode(' | ', $ops),
      );
    }
  }
  uasort($rows, 'drupal_sort_weight');
  return theme('table', array(
    'header' => $header,
    'rows' => $rows,
    'caption' => $caption,
  ));
}