function RulesPluginUI::settingsFormExtractValues

Parameters

array $form: The form array where to add the form.

array $form_state: The current form state.

2 calls to RulesPluginUI::settingsFormExtractValues()
RulesPluginUI::form_extract_values in ui/ui.core.inc
Applies the values of the form to the element.
RulesReactionRuleUI::settingsFormExtractValues in ui/ui.plugins.inc
1 method overrides RulesPluginUI::settingsFormExtractValues()
RulesReactionRuleUI::settingsFormExtractValues in ui/ui.plugins.inc

File

ui/ui.core.inc, line 593

Class

RulesPluginUI
Faces UI extender for all kind of Rules plugins.

Code

public function settingsFormExtractValues($form, &$form_state) {
    $form_values = RulesPluginUI::getFormStateValues($form['settings'], $form_state);
    $this->element->label = $form_values['label'];
    // If the name was changed we have to redirect to the URL that contains
    // the new name, instead of rebuilding on the old URL with the old name.
    if ($form['settings']['name']['#default_value'] != $form_values['name']) {
        $module = isset($this->element->module) ? $this->element->module : 'rules';
        $this->element->name = $module . '_' . $form_values['name'];
        $form_state['redirect'] = RulesPluginUI::path($this->element->name, 'edit', $this->element);
    }
    $this->element->tags = empty($form_values['tags']) ? array() : drupal_explode_tags($form_values['tags']);
    if (isset($form_values['vars']['items'])) {
        $vars =& $this->element
            ->componentVariables();
        $vars = array();
        if ($this->element instanceof RulesActionContainer) {
            $provides =& $this->element
                ->componentProvidesVariables();
            $provides = array();
        }
        usort($form_values['vars']['items'], 'rules_element_sort_helper');
        foreach ($form_values['vars']['items'] as $item) {
            if ($item['type'] && $item['name'] && $item['label']) {
                $vars[$item['name']] = array(
                    'label' => $item['label'],
                    'type' => $item['type'],
                );
                if (!$item['usage'][0]) {
                    $vars[$item['name']]['parameter'] = FALSE;
                }
                if ($item['usage'][1] && isset($provides)) {
                    $provides[] = $item['name'];
                }
            }
        }
        // Disable FAPI persistence for the variable form so renumbering works.
        $input =& $form_state['input'];
        foreach ($form['settings']['#parents'] as $parent) {
            $input =& $input[$parent];
        }
        unset($input['vars']);
    }
    $this->element->access_exposed = isset($form_values['access']['access_exposed']) ? $form_values['access']['access_exposed'] : FALSE;
}