class RulesDataUIEventStateReference in Booking and Availability Management Tools for Drupal 7
Defines a bat_event_state_reference input form for Rules.
Hierarchy
- class \RulesDataUI
- class \RulesDataUIEventStateReference implements RulesDataDirectInputFormInterface
Expanded class hierarchy of RulesDataUIEventStateReference
1 string reference to 'RulesDataUIEventStateReference'
- bat_event_rules_data_info in modules/
bat_event/ bat_event.rules.inc - Implements hook_rules_data_info().
File
- modules/
bat_event/ bat_event.rules.inc, line 24
View source
class RulesDataUIEventStateReference extends RulesDataUI implements RulesDataDirectInputFormInterface {
/**
* {@inheritdoc}
*/
public static function getDefaultMode() {
return 'input';
}
/**
* {@inheritdoc}
*/
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;
}
/**
* {@inheritdoc}
*/
public static function render($value) {
return array(
'content' => array(
'#markup' => $value['state'],
),
);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
RulesDataUI:: |
public static | function | Returns the data type and parameter information for the given arguments. | |
RulesDataUI:: |
public static | function | Renders the value with a label if an options list is available. | |
RulesDataUI:: |
public static | function | Provides the selection form for a parameter. | |
RulesDataUIEventStateReference:: |
public static | function |
Specifies the default input mode per data type. Overrides RulesDataUI:: |
|
RulesDataUIEventStateReference:: |
public static | function |
Constructs the direct input form. Overrides RulesDataDirectInputFormInterface:: |
|
RulesDataUIEventStateReference:: |
public static | function |
Render the configured value. Overrides RulesDataDirectInputFormInterface:: |