You are here

public static function RulesDataUIEventStateReference::inputForm in Booking and Availability Management Tools for Drupal 7

Constructs the direct input form.

Return value

array The direct input form.

Overrides RulesDataDirectInputFormInterface::inputForm

File

modules/bat_event/bat_event.rules.inc, line 36

Class

RulesDataUIEventStateReference
Defines a bat_event_state_reference input form for Rules.

Code

public static function inputForm($name, $info, $settings, RulesPlugin $element) {
  $settings += array(
    $name => isset($info['default value']) ? $info['default value'] : array(
      'state' => '',
    ),
  );
  $value = $settings[$name];
  $options = array();
  foreach (bat_event_get_states() as $state) {
    $options[$state['machine_name']] = $state['label'] . ' (' . $state['id'] . ')';
  }
  $form[$name]['state'] = array(
    '#type' => 'select',
    '#options' => $options,
    '#default_value' => isset($value['state']) ? $value['state'] : '',
    '#required' => TRUE,
  );
  return $form;
}