diff --git a/core/modules/block/custom_block/lib/Drupal/custom_block/Controller/CustomBlockController.php b/core/modules/block/custom_block/lib/Drupal/custom_block/Controller/CustomBlockController.php index 5782fad..bd32040 100644 --- a/core/modules/block/custom_block/lib/Drupal/custom_block/Controller/CustomBlockController.php +++ b/core/modules/block/custom_block/lib/Drupal/custom_block/Controller/CustomBlockController.php @@ -8,14 +8,14 @@ namespace Drupal\custom_block\Controller; use Drupal\Component\Plugin\PluginManagerInterface; +use Drupal\Core\Controller\ControllerBase; use Drupal\Core\DependencyInjection\ContainerInjectionInterface; use Drupal\Core\Entity\EntityStorageControllerInterface; use Drupal\custom_block\CustomBlockTypeInterface; -use Drupal\Core\StringTranslation\TranslationInterface; use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\HttpFoundation\Request; -class CustomBlockController implements ContainerInjectionInterface { +class CustomBlockController extends ControllerBase implements ContainerInjectionInterface { /** * The entity manager. @@ -39,13 +39,6 @@ class CustomBlockController implements ContainerInjectionInterface { protected $customBlockTypeStorage; /** - * The translation manager. - * - * @var \Drupal\Core\StringTranslation\TranslationInterface - */ - protected $translationManager; - - /** * {@inheritdoc} */ public static function create(ContainerInterface $container) { @@ -53,8 +46,7 @@ public static function create(ContainerInterface $container) { return new static( $entity_manager, $entity_manager->getStorageController('custom_block'), - $entity_manager->getStorageController('custom_block_type'), - $container->get('string_translation') + $entity_manager->getStorageController('custom_block_type') ); } @@ -67,14 +59,11 @@ public static function create(ContainerInterface $container) { * The custom block storage controller. * @param \Drupal\Core\Entity\EntityStorageControllerInterface $custom_block_type_storage * The custom block type storage controller. - * @param \Drupal\Core\StringTranslation\TranslationInterface $translation_manager - * The translation manager. */ - public function __construct(PluginManagerInterface $entity_manager, EntityStorageControllerInterface $custom_block_storage, EntityStorageControllerInterface $custom_block_type_storage, TranslationInterface $translation_manager) { + public function __construct(PluginManagerInterface $entity_manager, EntityStorageControllerInterface $custom_block_storage, EntityStorageControllerInterface $custom_block_type_storage) { $this->customBlockStorage = $custom_block_storage; $this->customBlockTypeStorage = $custom_block_type_storage; $this->entityManager = $entity_manager; - $this->translationManager = $translation_manager; } /** @@ -122,22 +111,17 @@ public function addForm(CustomBlockTypeInterface $custom_block_type, Request $re return $this->entityManager->getForm($block); } - public function geFormTitle(CustomBlockTypeInterface $custom_block_type, Request $request) { - return $this->t('Add %type custom block', - array( - '%type' => $custom_block_type->label() - ) - ); - - } - /** - * Translates a string to the current language or to a given language. + * Provides the page title for this controller. + * + * @param \Drupal\custom_block\CustomBlockTypeInterface $custom_block_type + * The custom block type being added. * - * See the t() documentation for details. + * @return string + * The page title. */ - protected function t($string, array $args = array(), array $options = array()) { - return $this->translationManager->translate($string, $args, $options); + public function geFormTitle(CustomBlockTypeInterface $custom_block_type) { + return $this->t('Add %type custom block', array('%type' => $custom_block_type->label())); } }