class ProfileTranslationController

Defines the translation controller class for terms.

Hierarchy

Expanded class hierarchy of ProfileTranslationController

File

drupal/core/modules/user/lib/Drupal/user/ProfileTranslationController.php, line 16
Definition of Drupal\user\ProfileTranslationController.

Namespace

Drupal\user
View source
class ProfileTranslationController extends EntityTranslationController {

  /**
   * Overrides EntityTranslationController::entityFormAlter().
   */
  public function entityFormAlter(array &$form, array &$form_state, EntityInterface $entity) {
    parent::entityFormAlter($form, $form_state, $entity);
    $form['actions']['submit']['#submit'][] = array(
      $this,
      'entityFormSave',
    );
  }

  /**
   * Form submission handler for ProfileTranslationController::entityFormAlter().
   *
   * This handles the save action.
   *
   * @see \Drupal\Core\Entity\EntityFormController::build().
   */
  function entityFormSave(array $form, array &$form_state) {
    if ($this
      ->getSourceLangcode($form_state)) {
      $entity = translation_entity_form_controller($form_state)
        ->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['redirect'] = $this
        ->getViewPath($entity);
    }
  }

}

Members

Namesort descending Modifiers Type Description Overrides
EntityTranslationController::$entityInfo protected property The entity info of the entity being translated.
EntityTranslationController::$entityType protected property The type of the entity being translated.
EntityTranslationController::addTranslatabilityClue protected function Adds a clue about the form element translatability.
EntityTranslationController::entityFormDelete function Form submission handler for EntityTranslationController::entityFormAlter().
EntityTranslationController::entityFormDeleteTranslation function Form submission handler for EntityTranslationController::entityFormAlter().
EntityTranslationController::entityFormEntityBuild public function Entity builder method. 1
EntityTranslationController::entityFormSharedElements public function Process callback: determines which elements get clue in the form.
EntityTranslationController::entityFormSourceChange public function Form submission handler for EntityTranslationController::entityFormAlter().
EntityTranslationController::entityFormTitle protected function Returns the title to be used for the entity form page. 3
EntityTranslationController::entityFormValidate function Form validation handler for EntityTranslationController::entityFormAlter().
EntityTranslationController::getAccess public function Implements EntityTranslationControllerInterface::getAccess(). Overrides EntityTranslationControllerInterface::getAccess 2
EntityTranslationController::getBasePath public function Implements EntityTranslationControllerInterface::getBasePath(). Overrides EntityTranslationControllerInterface::getBasePath
EntityTranslationController::getEditPath public function Implements EntityTranslationControllerInterface::getEditPath(). Overrides EntityTranslationControllerInterface::getEditPath
EntityTranslationController::getPathInstance protected function Returns an instance of the given path.
EntityTranslationController::getSourceLangcode public function Implements EntityTranslationControllerInterface::getSourceLanguage(). Overrides EntityTranslationControllerInterface::getSourceLangcode
EntityTranslationController::getTranslationAccess public function Implements EntityTranslationControllerInterface::getTranslationAccess(). Overrides EntityTranslationControllerInterface::getTranslationAccess
EntityTranslationController::getViewPath public function Implements EntityTranslationControllerInterface::getViewPath(). Overrides EntityTranslationControllerInterface::getViewPath
EntityTranslationController::removeTranslation public function Implements EntityTranslationControllerInterface::removeTranslation(). Overrides EntityTranslationControllerInterface::removeTranslation 1
EntityTranslationController::retranslate public function Implements EntityTranslationControllerInterface::retranslate(). Overrides EntityTranslationControllerInterface::retranslate
EntityTranslationController::__construct public function Initializes an instance of the entity translation controller.
ProfileTranslationController::entityFormAlter public function Overrides EntityTranslationController::entityFormAlter(). Overrides EntityTranslationController::entityFormAlter
ProfileTranslationController::entityFormSave function Form submission handler for ProfileTranslationController::entityFormAlter().