function RulesPluginUI::getVariableForm

Returns the form for configuring the info of a single variable.

1 call to RulesPluginUI::getVariableForm()
RulesPluginUI::settingsForm in ui/ui.core.inc
Adds the configuration settings form (label, tags, description, ...).

File

ui/ui.core.inc, line 672

Class

RulesPluginUI
Faces UI extender for all kind of Rules plugins.

Code

public function getVariableForm($name = '', $info = array(), $provided = FALSE) {
    $form['type'] = array(
        '#type' => 'select',
        '#options' => array(
            0 => '--',
        ) + RulesPluginUI::getOptions('data'),
        '#default_value' => isset($info['type']) ? $info['type'] : 0,
    );
    $form['label'] = array(
        '#type' => 'textfield',
        '#size' => 40,
        '#default_value' => isset($info['label']) ? $info['label'] : '',
    );
    $form['name'] = array(
        '#type' => 'textfield',
        '#size' => 40,
        '#default_value' => $name,
        '#element_validate' => array(
            'rules_ui_element_machine_name_validate',
        ),
    );
    $usage[0] = !isset($info['parameter']) || $info['parameter'] ? 1 : 0;
    $usage[1] = $provided ? 1 : 0;
    $form['usage'] = array(
        '#type' => 'select',
        '#default_value' => implode('', $usage),
        '#options' => array(
            '10' => t('Parameter'),
            '11' => t('Parameter + Provided'),
            '01' => t('Provided'),
        ),
    );
    if ($this->element instanceof RulesConditionContainer) {
        $form['usage']['#disabled'] = TRUE;
    }
    // Just set the weight #default_value for the returned form.
    $form['weight'] = array(
        '#type' => 'weight',
    );
    return $form;
}