Loading CHANGELOG.txt +2 −0 Original line number Diff line number Diff line Loading @@ -19,6 +19,8 @@ Metatag 8.x-1.x-dev, xxxx-xx-xx validateGroupExist(). #3111875 by Hardik_Patel_12: Replace \Drupal calls with dependency injection in MetatagFirehose.php. #3111900 by Hardik_Patel_12: Replace \Drupal calls with dependency injection in MetatagViewsTranslationController. Metatag 8.x-1.11, 2019-12-20 Loading metatag_views/src/Controller/MetatagViewsTranslationController.php +25 −5 Original line number Diff line number Diff line Loading @@ -8,6 +8,8 @@ use Drupal\Core\Language\LanguageManagerInterface; use Drupal\Core\Url; use Drupal\metatag\MetatagManagerInterface; use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\HttpFoundation\RequestStack; use Drupal\Core\Config\ConfigFactoryInterface; /** * Translate Views meta tags. Loading Loading @@ -35,13 +37,29 @@ class MetatagViewsTranslationController extends ControllerBase { */ protected $languageManager; /** * The request stack. * * @var \Symfony\Component\HttpFoundation\RequestStack */ protected $requestStack; /** * The configuration factory. * * @var \Drupal\Core\Config\ConfigFactoryInterface */ protected $configFactory; /** * {@inheritdoc} */ public function __construct(EntityStorageInterface $viewStorage, MetatagManagerInterface $metatagManager, LanguageManagerInterface $languageManager) { public function __construct(EntityStorageInterface $viewStorage, MetatagManagerInterface $metatagManager, LanguageManagerInterface $languageManager, RequestStack $request_stack, ConfigFactoryInterface $config_factory) { $this->viewStorage = $viewStorage; $this->metatagManager = $metatagManager; $this->languageManager = $languageManager; $this->requestStack = $request_stack; $this->configFactory = $config_factory; } /** Loading @@ -51,7 +69,9 @@ class MetatagViewsTranslationController extends ControllerBase { return new static( $container->get('entity_type.manager')->getStorage('view'), $container->get('metatag.manager'), $container->get('language_manager') $container->get('language_manager'), $container->get('request_stack'), $container->get('config.factory') ); } Loading @@ -62,8 +82,8 @@ class MetatagViewsTranslationController extends ControllerBase { * Page render array. */ public function itemPage() { $view_id = \Drupal::request()->get('view_id'); $display_id = \Drupal::request()->get('display_id'); $view_id = $this->requestStack->get('view_id'); $display_id = $this->requestStack->get('display_id'); $view = $this->viewStorage->load($view_id); $original_langcode = $view->language()->getId(); Loading @@ -71,7 +91,7 @@ class MetatagViewsTranslationController extends ControllerBase { $config_name = $view->getConfigDependencyName(); $config_path = 'display.' . $display_id . '.display_options.display_extenders.metatag_display_extender.metatags'; $configuration = \Drupal::service('config.factory')->get($config_name); $configuration = $this->configFactory->get($config_name); $config_source = $configuration->getOriginal($config_path, FALSE); $page['languages'] = [ Loading Loading
CHANGELOG.txt +2 −0 Original line number Diff line number Diff line Loading @@ -19,6 +19,8 @@ Metatag 8.x-1.x-dev, xxxx-xx-xx validateGroupExist(). #3111875 by Hardik_Patel_12: Replace \Drupal calls with dependency injection in MetatagFirehose.php. #3111900 by Hardik_Patel_12: Replace \Drupal calls with dependency injection in MetatagViewsTranslationController. Metatag 8.x-1.11, 2019-12-20 Loading
metatag_views/src/Controller/MetatagViewsTranslationController.php +25 −5 Original line number Diff line number Diff line Loading @@ -8,6 +8,8 @@ use Drupal\Core\Language\LanguageManagerInterface; use Drupal\Core\Url; use Drupal\metatag\MetatagManagerInterface; use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\HttpFoundation\RequestStack; use Drupal\Core\Config\ConfigFactoryInterface; /** * Translate Views meta tags. Loading Loading @@ -35,13 +37,29 @@ class MetatagViewsTranslationController extends ControllerBase { */ protected $languageManager; /** * The request stack. * * @var \Symfony\Component\HttpFoundation\RequestStack */ protected $requestStack; /** * The configuration factory. * * @var \Drupal\Core\Config\ConfigFactoryInterface */ protected $configFactory; /** * {@inheritdoc} */ public function __construct(EntityStorageInterface $viewStorage, MetatagManagerInterface $metatagManager, LanguageManagerInterface $languageManager) { public function __construct(EntityStorageInterface $viewStorage, MetatagManagerInterface $metatagManager, LanguageManagerInterface $languageManager, RequestStack $request_stack, ConfigFactoryInterface $config_factory) { $this->viewStorage = $viewStorage; $this->metatagManager = $metatagManager; $this->languageManager = $languageManager; $this->requestStack = $request_stack; $this->configFactory = $config_factory; } /** Loading @@ -51,7 +69,9 @@ class MetatagViewsTranslationController extends ControllerBase { return new static( $container->get('entity_type.manager')->getStorage('view'), $container->get('metatag.manager'), $container->get('language_manager') $container->get('language_manager'), $container->get('request_stack'), $container->get('config.factory') ); } Loading @@ -62,8 +82,8 @@ class MetatagViewsTranslationController extends ControllerBase { * Page render array. */ public function itemPage() { $view_id = \Drupal::request()->get('view_id'); $display_id = \Drupal::request()->get('display_id'); $view_id = $this->requestStack->get('view_id'); $display_id = $this->requestStack->get('display_id'); $view = $this->viewStorage->load($view_id); $original_langcode = $view->language()->getId(); Loading @@ -71,7 +91,7 @@ class MetatagViewsTranslationController extends ControllerBase { $config_name = $view->getConfigDependencyName(); $config_path = 'display.' . $display_id . '.display_options.display_extenders.metatag_display_extender.metatags'; $configuration = \Drupal::service('config.factory')->get($config_name); $configuration = $this->configFactory->get($config_name); $config_source = $configuration->getOriginal($config_path, FALSE); $page['languages'] = [ Loading