コード例 #1
0
 /**
  * {@inheritdoc}
  */
 public function validateForm(array &$form, FormStateInterface $form_state)
 {
     // Ensure the object properties are initialized, see
     // https://www.drupal.org/node/2669032.
     $this->rulesUiHandler = $form_state->get('rules_ui_handler');
     $this->component = is_object($form_state->get('component')) ? $form_state->get('component') : $this->rulesUiHandler->getComponent();
     $this->uuid = $form_state->get('uuid');
     $this->rulesUiHandler->validateLock($form, $form_state);
     // @todo: This ignores ExpressionFormInterface::validateForm().
     $component = $this->buildComponent($form, $form_state);
     $violations = $component->checkIntegrity();
     // Only show the violations caused by the edited expression.
     foreach ($violations->getFor($this->uuid) as $violation) {
         $form_state->setError($form, $violation->getMessage());
     }
 }
コード例 #2
0
 /**
  * {@inheritdoc}
  */
 public function validateForm(array &$form, FormStateInterface $form_state)
 {
     $this->rulesUiHandler->validateLock($form, $form_state);
     $this->getFormHandler()->validateForm($form, $form_state);
 }