function RulesDataUIListText::inputForm

Implements RulesDataDirectInputFormInterface::inputForm().

@todo This does not work for inputting textual values including "\n".

Overrides RulesDataUIText::inputForm

1 call to RulesDataUIListText::inputForm()
RulesDataUIListInteger::inputForm in ui/ui.data.inc
Implements RulesDataDirectInputFormInterface::inputForm().
1 method overrides RulesDataUIListText::inputForm()
RulesDataUIListInteger::inputForm in ui/ui.data.inc
Implements RulesDataDirectInputFormInterface::inputForm().

File

ui/ui.data.inc, line 498

Class

RulesDataUIListText
UI for lists of textual data.

Code

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;
}