You are here

class FormBaseAlterEvent in Hook Event Dispatcher 8

Class FormBaserAlterEvent.

Hierarchy

Expanded class hierarchy of FormBaseAlterEvent

2 files declare their use of FormBaseAlterEvent
ExampleFormEventSubscribers.php in src/Example/ExampleFormEventSubscribers.php
hook_event_dispatcher.module in ./hook_event_dispatcher.module
Hook event dispatcher module.

File

src/Event/Form/FormBaseAlterEvent.php, line 10

Namespace

Drupal\hook_event_dispatcher\Event\Form
View source
class FormBaseAlterEvent extends BaseFormEvent {

  /**
   * The base form id.
   *
   * @var string
   */
  protected $baseFormId;

  /**
   * FormBaseAlterEvent constructor.
   *
   * @param array $form
   *   Nested array of form elements that comprise the form.
   * @param \Drupal\Core\Form\FormStateInterface $formState
   *   The current state of the form. The arguments that
   *   \Drupal::formBuilder()->getForm() was originally called with are
   *   available in the array $form_state->getBuildInfo()['args'].
   * @param string $formId
   *   String representing the name of the form itself. Typically this is the
   *   name of the function that generated the form.
   * @param string $baseFormId
   *   The base form id.
   */
  public function __construct(array &$form, FormStateInterface $formState, $formId, $baseFormId) {
    parent::__construct($form, $formState, $formId);
    $this->baseFormId = $baseFormId;
  }

  /**
   * {@inheritdoc}
   */
  public function getDispatcherType() {
    return 'hook_event_dispatcher.form_base_' . $this
      ->getBaseFormId() . '.alter';
  }

  /**
   * Get the base form id.
   *
   * @return string
   *   The base form id.
   */
  public function getBaseFormId() {
    return $this->baseFormId;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
BaseFormEvent::$form protected property The form.
BaseFormEvent::$formId protected property The form id.
BaseFormEvent::$formState protected property The form state.
BaseFormEvent::getForm public function Get the form.
BaseFormEvent::getFormId public function Get the form id.
BaseFormEvent::getFormState public function Get the form state.
BaseFormEvent::setForm Deprecated public function Set the form.
FormBaseAlterEvent::$baseFormId protected property The base form id.
FormBaseAlterEvent::getBaseFormId public function Get the base form id.
FormBaseAlterEvent::getDispatcherType public function Get the dispatcher type. Overrides EventInterface::getDispatcherType
FormBaseAlterEvent::__construct public function FormBaseAlterEvent constructor. Overrides BaseFormEvent::__construct