function EditExpressionForm::buildComponent

Builds an updated component object based upon the submitted form values.

Parameters

array $form: An associative array containing the structure of the form.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

Return value

\Drupal\rules\Engine\RulesComponent The updated component.

2 calls to EditExpressionForm::buildComponent()
EditExpressionForm::submitForm in src/Form/EditExpressionForm.php
Form submission handler.
EditExpressionForm::validateForm in src/Form/EditExpressionForm.php
Form validation handler.

File

src/Form/EditExpressionForm.php, line 92

Class

EditExpressionForm
UI form to edit an expression like a condition or action in a rule.

Namespace

Drupal\rules\Form

Code

protected function buildComponent(array $form, FormStateInterface $form_state) {
    $component = clone $this->component;
    // In order to update the whole component we need to invoke the submission
    // handler of the expression form. That way the expression gets changed
    // accordingly.
    $expression = $this->getEditedExpression($component);
    $form_handler = $expression->getFormHandler();
    $form_handler->submitForm($form, $form_state);
    return $component;
}