You are here

public function FormAlter::userRegistrationPasswordFormAlter in Form mode manager 8.2

Applies the user_register_form_alter on form_mode_manager register routes.

Parameters

array $form: An associative array containing the structure of the form.

\Drupal\Core\Form\FormStateInterface $formState: The current state of the form.

string $formId: The Form ID.

1 call to FormAlter::userRegistrationPasswordFormAlter()
FormAlter::formAlter in src/FormAlter.php
Allow to use user_registrationpassword form_alter with FormModeManager.

File

src/FormAlter.php, line 99

Class

FormAlter
Manipulates Form Alter information.

Namespace

Drupal\form_mode_manager

Code

public function userRegistrationPasswordFormAlter(array &$form, FormStateInterface $formState, $formId) {

  /** @var \Symfony\Component\Routing\Route $routeObject */
  $routeObject = $this->routeMatch
    ->getRouteObject();
  $dynamicFormId = str_replace('.', '_', $routeObject
    ->getDefault('_entity_form')) . '_form';

  // Prevent cases of register users create/register operations.
  if (FormModesSubscriber::isEditRoute($routeObject)) {
    return;
  }
  if ($this
    ->appliesUserRegistrationPasswordFormAlter($formId, $dynamicFormId)) {
    user_registrationpassword_form_user_register_form_alter($form, $formState);
  }
}