You are here

function rb_misc_action_views_result_count_form in Rules Bonus Pack 6

Configuration form for 'rb_misc_action_views_result_count'.

File

./rb_misc.module, line 174
Miscellaneous conditions and actions for Rules.

Code

function rb_misc_action_views_result_count_form($settings, &$form) {
  $selectable_displays = array();
  foreach (views_get_all_views() as $view_name => $view) {
    if ($view->base_table == 'node') {
      foreach ($view->display as $display_name => $display) {
        $selectable_displays[$view_name . '|' . $display_name] = $view_name . '|' . check_plain($display->display_title);
      }
    }
  }
  $form['settings']['view'] = array(
    '#type' => 'select',
    '#options' => $selectable_displays,
    '#default_value' => $settings['view'],
    '#title' => t('Select view and display'),
    '#description' => t('Select the view and the view display you want to use to
      load a node. The first node listed in the view will be loaded.'),
  );
  $form['settings']['args'] = array(
    '#type' => 'textarea',
    '#default_value' => $settings['args'],
    '#title' => t('View arguments'),
    '#description' => t('Add any arguments you want to send to the view, one per
      line. You may use tokens.'),
  );
  $form['settings']['minimum'] = array(
    '#type' => 'textfield',
    '#title' => t('Minimum number of results'),
    '#default_value' => $settings['minimum'],
    '#description' => t('This condition returns TRUE if the view has at least
      the given number of results.'),
  );
}