Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. ProfileTranslationHandler.php

function ProfileTranslationHandler::entityFormSave

Form submission handler for ProfileTranslationHandler::entityFormAlter().

This handles the save action.

See also

\Drupal\Core\Entity\EntityForm::build()

File

core/modules/user/src/ProfileTranslationHandler.php, line 45

Class

ProfileTranslationHandler
Defines the translation handler for users.

Namespace

Drupal\user

Code

public function entityFormSave(array $form, FormStateInterface $form_state) {
    if ($this->getSourceLangcode($form_state)) {
        $entity = $form_state->getFormObject()
            ->getEntity();
        // We need a redirect here, otherwise we would get an access denied page
        // since the current URL would be preserved and we would try to add a
        // translation for a language that already has a translation.
        $form_state->setRedirectUrl($entity->toUrl());
    }
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal