You are here

function rules_forms_admin_events in Rules 6

Defines the forms events settings form

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

File

rules_forms/rules_forms.admin.inc, line 12
Implements forms events management screen.

Code

function rules_forms_admin_events(&$form_state) {
  $form = array();
  $form['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('If checked, there will be a message on each form containing a link to activate events for the form. Only visible for your currently logged in user account.'),
  );
  $form['enable_form_element_ids'] = array(
    '#type' => 'checkbox',
    '#title' => t('Display form element IDs'),
    '#default_value' => isset($_SESSION['rules_forms_element_ids']) ? $_SESSION['rules_forms_element_ids'] : FALSE,
    '#description' => t('If checked, the identifier of every single form element will be displayed on event-activated forms. Only visible for your currently logged in user account.'),
  );
  $form['settings_submit'] = array(
    '#type' => 'submit',
    '#value' => t('Save settings'),
    '#submit' => array(
      'rules_forms_settings_submit',
    ),
  );
  $form_events = variable_get('rules_forms_events', array());
  if (!empty($form_events)) {
    $form['form_events'] = array(
      '#type' => 'checkboxes',
      '#title' => t('Forms where events are activated'),
      '#options' => $form_events,
      '#description' => t('Forms that currently invoke events. Select forms to deactivate events on them.'),
    );
    $form['events_deactivate'] = array(
      '#type' => 'submit',
      '#value' => t('Deactivate events'),
      '#submit' => array(
        'rules_forms_events_deactivate_submit',
      ),
    );
  }
  else {
    drupal_set_message('Enable the event activation messages below and go to the form you would like to activate events on.', 'status', FALSE);
  }
  return $form;
}