You are here

function notifications_admin_events_form in Notifications 6

Same name and namespace in other branches
  1. 5 notifications.admin.inc \notifications_admin_events_form()
  2. 6.4 notifications.admin.inc \notifications_admin_events_form()
  3. 6.2 notifications.admin.inc \notifications_admin_events_form()
  4. 6.3 notifications.admin.inc \notifications_admin_events_form()
  5. 7 notifications.admin.inc \notifications_admin_events_form()

Event configuration administration

Will allow to define which events trigger a notification and which ones not

1 string reference to 'notifications_admin_events_form'
notifications_menu in ./notifications.module
Implementation of hook_menu().

File

./notifications.admin.inc, line 227

Code

function notifications_admin_events_form() {

  // Compile array from plug-ins and settings
  $events = notifications_event_types();
  $current = variable_get('notifications_events', array());
  if ($events) {
    $form['notifications_events'] = array(
      '#title' => t('Enabled events'),
      '#type' => 'fieldset',
      '#tree' => TRUE,
      '#description' => t('Check the events for which notifications should be triggered.'),
    );
    foreach ($events as $object => $object_info) {
      foreach ($object_info as $action => $action_info) {
        $form['notifications_events'][$object][$action] = array(
          '#type' => 'checkbox',
          '#title' => !empty($action_info['description']) ? $action_info['description'] : "{$object}:{$action}",
          '#default_value' => isset($current[$object][$action]) ? $current[$object][$action] : 1,
        );
      }
    }
    return system_settings_form($form);
  }
  else {
    $form['warning'] = array(
      '#value' => t('You need to enable some plug-ins to provide notifications events.'),
    );
    return $form;
  }
}