public static function RulesFormsDataValue::inputForm in Rules Forms Support 7
Sets the input type based on the selected form element type.
Overrides RulesDataDirectInputFormInterface::inputForm
File
- includes/
rules_forms.ui.inc, line 187 - Defines data type classes for forms and form elements.
Class
- RulesFormsDataValue
- Provides a form for the value in Condition: Element has value.
Code
public static function inputForm($name, $info, $settings, RulesPlugin $element) {
$form = parent::defaultForm($name, $info, $settings, 'Value');
if (!empty($element->settings['element'])) {
$type = substr($element->settings['element'], 0, strpos($element->settings['element'], ':'));
if (in_array($type, array(
'checkboxes',
'radios',
'select',
'textfield',
))) {
$form[$name]['#type'] = 'textarea';
$form[$name]['#title'] = 'Value(s)';
}
else {
$form[$name]['#type'] = $type;
}
}
return $form;
}