You are here

function spaces_dashboard_admin_form in Spaces 7

Same name and namespace in other branches
  1. 6.3 spaces_dashboard/spaces_dashboard.admin.inc \spaces_dashboard_admin_form()
  2. 7.3 spaces_dashboard/spaces_dashboard.admin.inc \spaces_dashboard_admin_form()

Provide a form that allows administrators to select which blocks are available in which dashboards.

1 string reference to 'spaces_dashboard_admin_form'
spaces_dashboard_menu in spaces_dashboard/spaces_dashboard.module
Implements hook_menu().

File

spaces_dashboard/spaces_dashboard.admin.inc, line 43

Code

function spaces_dashboard_admin_form($form, &$form_state) {
  $blocks = context_get_plugin('reaction', 'block')
    ->get_blocks(NULL, NULL, TRUE);
  $default = variable_get('spaces_dashboard_blocks', array());
  $form['spaces_dashboard_blocks'] = array(
    '#tree' => TRUE,
    '#theme' => 'spaces_dashboard_admin_form',
  );
  ksort($blocks);
  foreach ($blocks as $k => $block) {
    $module = spaces_dashboard_get_module($block);
    $info = system_get_info('module', $module);
    $form['spaces_dashboard_blocks'][$k] = array(
      '#type' => 'checkbox',
      '#title' => $block->info,
      '#grouping' => $info['name'],
      '#grouping_id' => $module,
    );
    if (isset($default[$k])) {
      $form['spaces_dashboard_blocks'][$k]['#default_value'] = $default[$k];
    }
  }
  return system_settings_form($form);
}