You are here

function variable_admin_page_group in Variable 7

Same name and namespace in other branches
  1. 6 variable_admin/variable_admin.pages.inc \variable_admin_page_group()
  2. 7.2 variable_admin/variable_admin.inc \variable_admin_page_group()

Variable overview, by group

1 string reference to 'variable_admin_page_group'
variable_admin_menu in variable_admin/variable_admin.module
Implements hook_menu().

File

variable_admin/variable_admin.inc, line 10
Variable API module - Admin UI

Code

function variable_admin_page_group($group = NULL) {
  variable_include();
  if ($group && ($group_info = variable_get_group($group))) {
    $group_info += array(
      'description' => '',
    );
    drupal_set_title($group_info['title']);
    $list = variable_list_group($group);
    $build['description']['#markup'] = $group_info['description'];
    $build['form'] = drupal_get_form('variable_edit_form', array_keys($list));
    return $build;
  }
  else {

    // Groups overview
    $build['groups'] = array(
      '#type' => 'vertical_tabs',
    );
    foreach (variable_get_group() as $group => $info) {
      if ($group_variables = variable_list_group($group)) {
        $build['groups'][$group] = array(
          '#type' => 'fieldset',
          '#title' => $info['title'],
          '#collapsible' => TRUE,
          '#collapsed' => TRUE,
          '#description' => (!empty($info['description']) ? $info['description'] . ' ' : '') . l(t('Edit group variables'), 'admin/config/system/variable/group/' . $group),
        );
        $build['groups'][$group]['list'] = variable_admin_group_list($group_variables);
      }
    }
    return $build;
  }
}