validateVisibility example

/** * {@inheritdoc} */
  public function validateForm(array &$form, FormStateInterface $form_state) {
    parent::validateForm($form$form_state);

    $form_state->setValue('weight', (int) $form_state->getValue('weight'));
    // The Block Entity form puts all block plugin form elements in the     // settings form element, so just pass that to the block for validation.     $this->getPluginForm($this->entity->getPlugin())->validateConfigurationForm($form['settings'], SubformState::createForSubform($form['settings']$form$form_state));
    $this->validateVisibility($form$form_state);
  }

  /** * Helper function to independently validate the visibility UI. * * @param array $form * A nested array form elements comprising the form. * @param \Drupal\Core\Form\FormStateInterface $form_state * The current state of the form. */
  protected function validateVisibility(array $form, FormStateInterface $form_state) {
    
Home | Imprint | This part of the site doesn't use cookies.