You are here

function notifications_scheduler_new_posts_action_form in Notifications 7

Action: Configuration form

1 call to notifications_scheduler_new_posts_action_form()
notifications_scheduler_latest_posts_action_form in notifications_scheduler/notifications_scheduler.module
Action: Configuration form

File

notifications_scheduler/notifications_scheduler.module, line 202
Notifications scheduler module

Code

function notifications_scheduler_new_posts_action_form($context) {
  $form = notifications_scheduler_default_action_form($context, 'notifications_scheduler_new_posts');
  $form['node_type'] = array(
    '#title' => t('Content type'),
    '#type' => 'select',
    '#options' => array(
      '' => t('All types'),
    ) + node_type_get_names(),
    '#default_value' => isset($context['node_type']) ? $context['node_type'] : '',
  );

  // Terms is an array of tids, map to names for autocomplete field
  if (!empty($context['taxonomy_term']) && ($term = taxonomy_term_load($context['taxonomy_term']))) {
    $terms = taxonomy_term_title($term);
  }
  else {
    $terms = '';
  }

  // If we have the tags module enabled, allow tag condition too
  if (module_exists('notifications_tags')) {
    $form['taxonomy_term'] = array(
      '#title' => t('Taxonomy term'),
      '#type' => 'textfield',
      '#default_value' => $terms,
      '#autocomplete_path' => 'notifications_tags/autocomplete/simple',
      '#element_validate' => array(
        'notifications_tags_autocomplete_validate',
      ),
      '#disabled' => !(bool) notifications_tags_vocabulary_enabled(),
    );
  }
  return $form;
}