You are here

function spaces_dashboard_add in Spaces 7

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

Form for adding/editing custom Dashboards.

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

File

spaces_dashboard/spaces_dashboard.admin.inc, line 6

Code

function spaces_dashboard_add($form, &$form_state) {
  $custom = variable_get('spaces_dashboard_custom', array(
    'custom-1' => t('Dashboard'),
  ));
  $form = array();
  $form['spaces_dashboard_custom'] = array(
    '#description' => t('Enter a label for each dashboard you would like to use. To remove a custom dashboard clear its field.'),
    '#title' => t('Custom dashboards'),
    '#tree' => TRUE,
    '#type' => 'fieldset',
  );
  for ($i = 1; $i < 6; $i++) {
    $form['spaces_dashboard_custom']["custom-{$i}"] = array(
      '#type' => 'textfield',
      '#default_value' => isset($custom["custom-{$i}"]) ? $custom["custom-{$i}"] : '',
      '#element_validate' => array(
        'spaces_dashboard_add_validate',
      ),
    );
  }
  return system_settings_form($form);
}