You are here

function notifications_admin_events_form in Notifications 7

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 notifications.admin.inc \notifications_admin_events_form()
  4. 6.2 notifications.admin.inc \notifications_admin_events_form()
  5. 6.3 notifications.admin.inc \notifications_admin_events_form()

Event configuration administration

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

File

./notifications.admin.inc, line 220

Code

function notifications_admin_events_form($form, &$form_state) {

  // Compile template list by type
  $template_list = array();
  foreach (notifications_info('message templates') as $key => $template) {
    $template_list[$template['object']][$key] = $template['title'];
  }
  $header = array(
    'name' => t('Event type'),
    'template' => t('Template'),
    'triggers' => t('Triggers'),
  );
  $form['events'] = array(
    '#tree' => TRUE,
    '#type' => 'fieldset',
    '#theme' => 'notifications_admin_table_form',
    '#header' => $header,
    '#empty' => t('You need to enable some plug-ins to provide notifications events.'),
  );
  foreach (notifications_event_type() as $key => $event) {
    $form['events'][$key]['name']['#markup'] = $event['title'];
    $form['events'][$key]['template'] = array(
      '#type' => 'select',
      '#options' => isset($template_list[$event['object']]) ? $template_list[$event['object']] : array(),
      '#default_value' => $event['template'],
      '#parents' => array(
        'events',
        $key,
      ),
    );
    $form['events'][$key]['triggers']['#markup'] = implode(', ', notifications_admin_event_triggers($key));
  }
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Save configuration'),
  );
  return $form;
}