function ConditionContainerForm::submitForm
Overrides ExpressionFormTrait::submitForm
File
-
src/
Form/ Expression/ ConditionContainerForm.php, line 129
Class
- ConditionContainerForm
- Form view structure for Rules condition containers.
Namespace
Drupal\rules\Form\ExpressionCode
public function submitForm(array &$form, FormStateInterface $form_state) {
$values = $form_state->getValue('conditions', []);
if (empty($values)) {
// Core FormState::getValue() doesn't return the default parameter []
// when there are no values?
return;
}
$component = $this->getRulesUiHandler()
->getComponent();
/** @var \Drupal\rules\Plugin\RulesExpression\RuleExpression $rule_expression */
$rule_expression = $component->getExpression();
foreach ($values as $uuid => $expression) {
$condition = $rule_expression->getExpression($uuid);
$condition->setWeight($expression['weight']);
$condition->setConfiguration($condition->getConfiguration());
}
$this->getRulesUiHandler()
->updateComponent($component);
}