class RulesDataUIListText
UI for lists of textual data.
Hierarchy
- class \RulesDataUI
- class \RulesDataUIText extends \RulesDataUI implements \RulesDataDirectInputFormInterface
- class \RulesDataUIListText extends \RulesDataUIText
- class \RulesDataUIText extends \RulesDataUI implements \RulesDataDirectInputFormInterface
Expanded class hierarchy of RulesDataUIListText
1 string reference to 'RulesDataUIListText'
- rules_rules_core_data_info in modules/
rules_core.rules.inc - Implements hook_rules_data_info() on behalf of the pseudo rules_core module.
File
-
ui/
ui.data.inc, line 484
View source
class RulesDataUIListText extends RulesDataUIText {
/**
* Overrides RulesDataUI::getDefaultMode().
*/
public static function getDefaultMode() {
return 'input';
}
/**
* Implements RulesDataDirectInputFormInterface::inputForm().
*
* @todo This does not work for inputting textual values including "\n".
*/
public static function inputForm($name, $info, $settings, RulesPlugin $element) {
$settings += array(
$name => isset($info['default value']) ? $info['default value'] : NULL,
);
$form = parent::inputForm($name, $info, $settings, $element);
if ($form[$name]['#type'] == 'textarea') {
// Fix up the value to be an array during after build.
$form[$name]['#delimiter'] = "\n";
$form[$name]['#after_build'][] = 'rules_ui_list_textarea_after_build';
$form[$name]['#pre_render'][] = 'rules_ui_list_textarea_pre_render';
$form[$name]['#default_value'] = !empty($settings[$name]) ? implode("\n", $settings[$name]) : NULL;
$form[$name]['#description'] = t('A list of values, one on each line.');
}
else {
$form[$name]['#multiple'] = TRUE;
}
return $form;
}
/**
* Implements RulesDataDirectInputFormInterface::render().
*/
public static function render($value) {
return array(
'content' => array(
'#markup' => check_plain(implode(', ', $value)),
),
'#attributes' => array(
'class' => array(
'rules-parameter-list',
),
),
);
}
}
Members
Title Sort descending | Modifiers | Object type | Summary | Overriden Title | Overrides |
---|---|---|---|---|---|
RulesDataUI::getTypeInfo | public static | function | Returns the data type and parameter information for the given arguments. | ||
RulesDataUI::renderOptionsLabel | public static | function | Renders the value with a label if an options list is available. | ||
RulesDataUI::selectionForm | public static | function | Provides the selection form for a parameter. | ||
RulesDataUIListText::getDefaultMode | public static | function | Overrides RulesDataUI::getDefaultMode(). | Overrides RulesDataUIText::getDefaultMode | |
RulesDataUIListText::inputForm | public static | function | Implements RulesDataDirectInputFormInterface::inputForm(). | Overrides RulesDataUIText::inputForm | 1 |
RulesDataUIListText::render | public static | function | Implements RulesDataDirectInputFormInterface::render(). | Overrides RulesDataUIText::render |