You are here

function rules_forms_admin_events in Rules Forms Support 7.2

Same name and namespace in other branches
  1. 7 includes/rules_forms.admin.inc \rules_forms_admin_events()

Defines the forms events settings form.

1 string reference to 'rules_forms_admin_events'
rules_forms_menu in ./rules_forms.module
Implements hook_menu().

File

includes/rules_forms.admin.inc, line 11
Administrative forms for Rules Forms module.

Code

function rules_forms_admin_events($form, &$form_state) {
  $form = array();
  $form['general_settings'] = array(
    '#type' => 'fieldset',
    '#title' => t('General settings'),
    '#collapsible' => TRUE,
  );
  $form['general_settings']['enable_form_activation_message'] = array(
    '#type' => 'checkbox',
    '#title' => t('Enable event activation messages on forms'),
    '#default_value' => isset($_SESSION['rules_forms_message']) ? $_SESSION['rules_forms_message'] : FALSE,
    '#description' => t('When checked, a message is shown on every form containing a link to activate events for that form. This message will only be visible for this session.'),
  );
  $form['general_settings']['settings_submit'] = array(
    '#type' => 'submit',
    '#value' => t('Save settings'),
    '#submit' => array(
      'rules_forms_settings_submit',
    ),
  );
  $form_info = rules_forms_get_form_info();
  if (!empty($form_info)) {
    $options = array();
    foreach ($form_info as $form_id => $info) {
      $options[$form_id] = $info['label'];
    }
    $form['active_forms'] = array(
      '#type' => 'fieldset',
      '#title' => t('Active forms'),
      '#collapsible' => TRUE,
      '#collapsed' => TRUE,
    );
    $form['active_forms']['form_events'] = array(
      '#type' => 'checkboxes',
      '#title' => t('Events enabled forms'),
      '#options' => $options,
      '#description' => t('Forms currently changeable by associated events. You may prevent associated events from changing forms by selecting them and clicking on "Deactivate events".'),
    );
    $form['active_forms']['events_deactivate'] = array(
      '#type' => 'submit',
      '#value' => t('Deactivate events'),
      '#submit' => array(
        'rules_forms_events_deactivate_submit',
      ),
    );
  }
  else {
    drupal_set_message(t('To start creating form rules enable the "Enable event activation messages on forms" setting below and navigate to the form you would like to activate events for.'), 'status', FALSE);
  }
  return $form;
}