You are here

function theme_flag_admin_listing_disabled in Flag 7.3

Same name and namespace in other branches
  1. 6.2 includes/flag.admin.inc \theme_flag_admin_listing_disabled()
  2. 7.2 includes/flag.admin.inc \theme_flag_admin_listing_disabled()

Theme the list of disabled flags into a table.

1 theme call to theme_flag_admin_listing_disabled()
theme_flag_admin_page in includes/flag.admin.inc
Theme the output for the main flag administration page.

File

includes/flag.admin.inc, line 139
Contains administrative pages for creating, editing, and deleting flags.

Code

function theme_flag_admin_listing_disabled($variables) {
  $flags = $variables['flags'];
  $default_flags = $variables['default_flags'];
  $output = '';

  // Build a list of disabled, module-based flags.
  $rows = array();
  foreach ($default_flags as $name => $flag) {
    if (!isset($flags[$name])) {
      $ops = array();
      if (!$flag
        ->is_compatible()) {
        $flag_updates_needed = TRUE;
        $ops['flags_update'] = array(
          'title' => '<strong>' . t('update code') . '</strong>',
          'href' => $flag
            ->admin_path('update'),
          'html' => TRUE,
        );
      }
      else {
        $ops['flags_enable'] = array(
          'title' => t('enable'),
          'href' => $flag
            ->admin_path('edit'),
        );
      }

      // $flag->roles['flag'] not exist on older flags.
      $roles = array_flip(array_intersect(array_flip(user_roles()), !empty($flag->roles['flag']) ? $flag->roles['flag'] : array()));
      $rows[] = array(
        $flag->name,
        $flag->module,
        $flag->entity_type ? $flag->entity_type : t('Unknown'),
        theme('links', array(
          'links' => $ops,
        )),
      );
    }
  }
  if (isset($flag_updates_needed)) {
    drupal_set_message(t('Some flags provided by modules need to be updated to a new format before they can be used with this version of Flag. See the disabled flags for a list of flags that need updating.'), 'warning');
  }
  if (!empty($rows)) {
    $header = array(
      t('Disabled Flags'),
      t('Module'),
      t('Flag type'),
      t('Operations'),
    );
    $output .= theme('table', array(
      'header' => $header,
      'rows' => $rows,
    ));
  }
  return $output;
}