You are here

public function SubmitButtonRules::configurationFormSubmit in Flexiform 8

Form Submit.

Overrides ConfigurableFormEnhancerBase::configurationFormSubmit

File

contrib/rules/src/Plugin/FormEnhancer/SubmitButtonRules.php, line 202

Class

SubmitButtonRules
A flexiform enhancer to trigger rules on submission.

Namespace

Drupal\flexiform_rules\Plugin\FormEnhancer

Code

public function configurationFormSubmit(array $form, FormStateInterface $form_state) {
  $parents = $form['#parents'];
  $values = $form_state
    ->getValue($parents);
  foreach ($values as $path => $rules) {
    $this->configuration[$path]['rules'] = [];
    foreach ($rules['rules'] as $rule_name => $info) {
      if ($rule_name != '__new_rule') {
        $this->configuration[$path]['rules'][$rule_name] = [
          'weight' => $info['weight'],
        ];
      }
    }
  }
}