You are here

function context_ui_settings in Context 7.3

Same name and namespace in other branches
  1. 6.3 context_ui/context_ui.module \context_ui_settings()

Settings form.

1 string reference to 'context_ui_settings'
context_ui_menu in context_ui/context_ui.module
Implementation of hook_menu().

File

context_ui/context_ui.module, line 279

Code

function context_ui_settings($form, &$form_state) {
  $form = array();
  foreach (context_conditions() as $condition => $info) {
    if ($plugin = context_get_plugin('condition', $condition)) {
      $settings_form = $plugin
        ->settings_form();
      if ($settings_form) {
        $form['conditions'][$condition] = $settings_form;
        $form['conditions'][$condition]['#tree'] = FALSE;
        $form['conditions'][$condition]['#type'] = 'fieldset';
        $form['conditions'][$condition]['#title'] = $info['title'];
      }
    }
  }
  foreach (context_reactions() as $reaction => $info) {
    if ($plugin = context_get_plugin('reaction', $reaction)) {
      $settings_form = $plugin
        ->settings_form();
      if ($settings_form) {
        $form['reactions'][$reaction] = $settings_form;
        $form['reactions'][$reaction]['#tree'] = FALSE;
        $form['reactions'][$reaction]['#type'] = 'fieldset';
        $form['reactions'][$reaction]['#title'] = $info['title'];
      }
    }
  }
  $form['context_ui_dialog_enabled'] = array(
    '#type' => 'checkbox',
    '#title' => t('Use context editor dialog'),
    '#default_value' => context_ui_dialog_is_enabled(),
    '#description' => t('When enabled all contextual links will have a <em>Edit layout</em> link that will refresh the page with the context editor in a dialog box.'),
  );
  $form = system_settings_form($form);
  $form['#submit'][] = 'context_ui_settings_submit';
  return $form;
}