You are here

function event_type_filter_form in Event 5

Same name and namespace in other branches
  1. 5.2 event.module \event_type_filter_form()

Builds the form array for the content type input control.

Parameters

$curtype The current type id.:

$autosubmit Adds 'onChange' form submit javascript command to control.:

Return value

An array representing the form.

1 string reference to 'event_type_filter_form'
_event_get_type_control in ./event.module
Returns a dropdown event-enabled content type input control.

File

./event.module, line 1728

Code

function event_type_filter_form($curtype, $autosubmit) {
  $results = event_get_types('all');
  $items['all'] = t('(all)');
  foreach ($results as $type) {
    if ($name = node_get_types('name', $type)) {
      $items[$type] = $name;
    }
  }
  $form['event_type_select'] = array(
    '#type' => 'select',
    '#default_value' => $curtype,
    '#options' => $items,
    '#description' => t('Select event type to filter by'),
  );
  if ($autosubmit) {
    $form['event_type_select']['#attributes'] = array(
      'onChange' => 'this.form.submit()',
    );
  }
  return $form;
}