external_entity-1.0.x-dev/src/Plugin/PluginFormTrait.php

src/Plugin/PluginFormTrait.php
<?php

declare(strict_types=1);

namespace Drupal\external_entity\Plugin;

use Drupal\Core\Form\FormStateInterface;

/**
 * Provides a trait for plugin forms.
 *
 * This trait provides default implementations for the
 * PluginFormInterface methods. It can be used by any class that needs to
 * implement a plugin form.
 */
trait PluginFormTrait {

  /**
   * {@inheritDoc}
   */
  public function buildConfigurationForm(
    array $form,
    FormStateInterface $form_state,
  ): array {
    return $form;
  }

  /**
   * {@inheritDoc}
   */
  public function validateConfigurationForm(
    array &$form,
    FormStateInterface $form_state,
  ): void {
    // Intentionally left empty as it's not required.
  }

  /**
   * {@inheritDoc}
   */
  public function submitConfigurationForm(
    array &$form,
    FormStateInterface $form_state,
  ): void {
    $this->setConfiguration($form_state->cleanValues()->getValues());
  }

}

Главная | Обратная связь

drupal hosting | друпал хостинг | it patrol .inc