class CustomBlockTranslationController

Defines the translation controller class for custom blocks.

Hierarchy

Expanded class hierarchy of CustomBlockTranslationController

File

drupal/core/modules/block/custom_block/lib/Drupal/custom_block/CustomBlockTranslationController.php, line 16
Contains \Drupal\custom_block\CustomBlockTranslationController.

Namespace

Drupal\custom_block
View source
class CustomBlockTranslationController extends EntityTranslationControllerNG {

  /**
   * Overrides EntityTranslationController::getAccess().
   */
  public function getAccess(EntityInterface $entity, $op) {
    return user_access('administer blocks');
  }

  /**
   * Overrides EntityTranslationController::entityFormAlter().
   */
  public function entityFormAlter(array &$form, array &$form_state, EntityInterface $entity) {
    parent::entityFormAlter($form, $form_state, $entity);

    // Move the translation fieldset to a vertical tab.
    if (isset($form['translation'])) {
      $form['translation'] += array(
        '#group' => 'additional_settings',
        '#weight' => 100,
        '#attributes' => array(
          'class' => array(
            'custom-block-translation-options',
          ),
        ),
      );
    }
  }

  /**
   * Overrides EntityTranslationController::entityFormTitle().
   */
  protected function entityFormTitle(EntityInterface $entity) {
    $block_type = entity_load('custom_block_type', $entity->type->value);
    return t('<em>Edit @type</em> @title', array(
      '@type' => $block_type
        ->label(),
      '@title' => $entity
        ->label(),
    ));
  }

}

Members

Namesort descending Modifiers Type Description Overrides
CustomBlockTranslationController::entityFormAlter public function Overrides EntityTranslationController::entityFormAlter(). Overrides EntityTranslationController::entityFormAlter
CustomBlockTranslationController::entityFormTitle protected function Overrides EntityTranslationController::entityFormTitle(). Overrides EntityTranslationController::entityFormTitle
CustomBlockTranslationController::getAccess public function Overrides EntityTranslationController::getAccess(). Overrides EntityTranslationControllerNG::getAccess
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::entityFormValidate function Form validation handler for EntityTranslationController::entityFormAlter().
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::retranslate public function Implements EntityTranslationControllerInterface::retranslate(). Overrides EntityTranslationControllerInterface::retranslate
EntityTranslationController::__construct public function Initializes an instance of the entity translation controller.
EntityTranslationControllerNG::removeTranslation public function Overrides \Drupal\translation_entity\EntityTranslationControllerInterface::removeTranslation(). Overrides EntityTranslationController::removeTranslation