diff --git a/core/core.services.yml b/core/core.services.yml index 5399bc7..23ce7bf 100644 --- a/core/core.services.yml +++ b/core/core.services.yml @@ -159,7 +159,7 @@ services: - { name: persist } plugin.manager.entity: class: Drupal\Core\Entity\EntityManager - arguments: ['@container.namespaces', '@service_container', '@module_handler', '@cache.cache', '@language_manager'] + arguments: ['@container.namespaces', '@service_container', '@module_handler', '@cache.cache', '@language_manager', '@string_translation'] plugin.manager.entity.field.field_type: class: Drupal\Core\Entity\Field\FieldTypePluginManager arguments: ['@container.namespaces', '@cache.entity', '@language_manager', '@module_handler'] diff --git a/core/lib/Drupal/Core/Entity/EntityConfirmFormBase.php b/core/lib/Drupal/Core/Entity/EntityConfirmFormBase.php index 8377958..565514d 100644 --- a/core/lib/Drupal/Core/Entity/EntityConfirmFormBase.php +++ b/core/lib/Drupal/Core/Entity/EntityConfirmFormBase.php @@ -7,6 +7,7 @@ namespace Drupal\Core\Entity; +use Drupal\Component\Utility\Url; use Drupal\Core\Form\ConfirmFormInterface; use Symfony\Component\HttpFoundation\Request; @@ -86,8 +87,9 @@ protected function actions(array $form, array &$form_state) { $path = $this->getCancelPath(); // Prepare cancel link. - if ($this->getRequest()->query->has('destination')) { - $options = drupal_parse_url($this->getRequest()->query->get('destination')); + $query = $this->getRequest()->query; + if ($query->has('destination')) { + $options = Url::parse($query->get('destination')); } elseif (is_array($path)) { $options = $path; diff --git a/core/lib/Drupal/Core/Entity/EntityFormController.php b/core/lib/Drupal/Core/Entity/EntityFormController.php index a008f90..372bf35 100644 --- a/core/lib/Drupal/Core/Entity/EntityFormController.php +++ b/core/lib/Drupal/Core/Entity/EntityFormController.php @@ -8,7 +8,6 @@ namespace Drupal\Core\Entity; use Drupal\Core\Form\FormBase; -use Drupal\Core\StringTranslation\Translator\TranslatorInterface; use Drupal\entity\EntityFormDisplayInterface; use Drupal\Core\Extension\ModuleHandlerInterface; use Drupal\Core\Language\Language; @@ -545,14 +544,6 @@ public function getOperation() { /** * {@inheritdoc} */ - public function setTranslationManager(TranslatorInterface $translation_manager) { - $this->translationManager = $translation_manager; - return $this; - } - - /** - * {@inheritdoc} - */ public function setModuleHandler(ModuleHandlerInterface $module_handler) { $this->moduleHandler = $module_handler; return $this; diff --git a/core/lib/Drupal/Core/Entity/EntityFormControllerInterface.php b/core/lib/Drupal/Core/Entity/EntityFormControllerInterface.php index 1f0664a..07d8af1 100644 --- a/core/lib/Drupal/Core/Entity/EntityFormControllerInterface.php +++ b/core/lib/Drupal/Core/Entity/EntityFormControllerInterface.php @@ -9,7 +9,7 @@ use Drupal\Core\Extension\ModuleHandlerInterface; use Drupal\Core\Form\BaseFormIdInterface; -use Drupal\Core\StringTranslation\Translator\TranslatorInterface; +use Drupal\Core\StringTranslation\TranslationInterface; use Drupal\entity\EntityFormDisplayInterface; /** @@ -155,13 +155,13 @@ public function submit(array $form, array &$form_state); /** * Sets the translation manager for this form. * - * @param \Drupal\Core\StringTranslation\Translator\TranslatorInterface $translation_manager + * @param \Drupal\Core\StringTranslation\TranslationInterface $translation_manager * The translation manager. * * @return self * The entity form. */ - public function setTranslationManager(TranslatorInterface $translation_manager); + public function setTranslationManager(TranslationInterface $translation_manager); /** * Sets the module handler for this form. diff --git a/core/lib/Drupal/Core/Entity/EntityManager.php b/core/lib/Drupal/Core/Entity/EntityManager.php index 3443aa6..eeb1cac 100644 --- a/core/lib/Drupal/Core/Entity/EntityManager.php +++ b/core/lib/Drupal/Core/Entity/EntityManager.php @@ -18,6 +18,7 @@ use Drupal\Core\Plugin\Discovery\AnnotatedClassDiscovery; use Drupal\Core\Plugin\Discovery\InfoHookDecorator; use Drupal\Core\Cache\CacheBackendInterface; +use Drupal\Core\StringTranslation\TranslationInterface; use Symfony\Component\DependencyInjection\ContainerInterface; /** @@ -88,6 +89,13 @@ class EntityManager extends PluginManagerBase { protected $fieldDefinitions; /** + * The string translationManager. + * + * @var \Drupal\Core\StringTranslation\TranslationInterface + */ + protected $translationManager; + + /** * Constructs a new Entity plugin manager. * * @param \Traversable $namespaces @@ -101,8 +109,10 @@ class EntityManager extends PluginManagerBase { * The cache backend to use. * @param \Drupal\Core\Language\LanguageManager $language_manager * The language manager. + * @param \Drupal\Core\StringTranslation\TranslationInterface $translation_manager + * The string translationManager. */ - public function __construct(\Traversable $namespaces, ContainerInterface $container, ModuleHandlerInterface $module_handler, CacheBackendInterface $cache, LanguageManager $language_manager) { + public function __construct(\Traversable $namespaces, ContainerInterface $container, ModuleHandlerInterface $module_handler, CacheBackendInterface $cache, LanguageManager $language_manager, TranslationInterface $translation_manager) { // Allow the plugin definition to be altered by hook_entity_info_alter(). $annotation_namespaces = array( 'Drupal\Core\Entity\Annotation' => DRUPAL_ROOT . '/core/lib', @@ -111,6 +121,7 @@ public function __construct(\Traversable $namespaces, ContainerInterface $contai $this->moduleHandler = $module_handler; $this->cache = $cache; $this->languageManager = $language_manager; + $this->translationManager = $translation_manager; $this->discovery = new AnnotatedClassDiscovery('Entity', $namespaces, $annotation_namespaces, 'Drupal\Core\Entity\Annotation\EntityType'); $this->discovery = new InfoHookDecorator($this->discovery, 'entity_info'); @@ -237,8 +248,8 @@ public function getFormController($entity_type, $operation) { } $controller - ->setTranslationManager($this->container->get('string_translation')) - ->setModuleHandler($this->container->get('module_handler')) + ->setTranslationManager($this->translationManager) + ->setModuleHandler($this->moduleHandler) ->setOperation($operation); $this->controllers['form'][$operation][$entity_type] = $controller; } diff --git a/core/lib/Drupal/Core/Entity/EntityNGConfirmFormBase.php b/core/lib/Drupal/Core/Entity/EntityNGConfirmFormBase.php index 88d9d25..a400026 100644 --- a/core/lib/Drupal/Core/Entity/EntityNGConfirmFormBase.php +++ b/core/lib/Drupal/Core/Entity/EntityNGConfirmFormBase.php @@ -7,6 +7,7 @@ namespace Drupal\Core\Entity; +use Drupal\Component\Utility\Url; use Drupal\Core\Form\ConfirmFormInterface; /** @@ -85,8 +86,9 @@ protected function actions(array $form, array &$form_state) { $path = $this->getCancelPath(); // Prepare cancel link. - if ($this->getRequest()->query->has('destination')) { - $options = drupal_parse_url($this->getRequest()->query->get('destination')); + $query = $this->getRequest()->query; + if ($query->has('destination')) { + $options = Url::parse($query->get('destination')); } elseif (is_array($path)) { $options = $path; diff --git a/core/lib/Drupal/Core/Form/ConfirmFormBase.php b/core/lib/Drupal/Core/Form/ConfirmFormBase.php index 884c7c9..89e3ab7 100644 --- a/core/lib/Drupal/Core/Form/ConfirmFormBase.php +++ b/core/lib/Drupal/Core/Form/ConfirmFormBase.php @@ -7,6 +7,8 @@ namespace Drupal\Core\Form; +use Drupal\Component\Utility\Url; + /** * Provides an generic base class for a confirmation form. */ @@ -46,8 +48,9 @@ public function getFormName() { public function buildForm(array $form, array &$form_state) { $path = $this->getCancelPath(); // Prepare cancel link. - if ($this->getRequest()->query->has('destination')) { - $options = drupal_parse_url($this->getRequest()->query->get('destination')); + $query = $this->getRequest()->query; + if ($query->has('destination')) { + $options = Url::parse($query->get('destination')); } elseif (is_array($path)) { $options = $path; diff --git a/core/lib/Drupal/Core/Form/FormBase.php b/core/lib/Drupal/Core/Form/FormBase.php index 36b50d1..ca679ab 100644 --- a/core/lib/Drupal/Core/Form/FormBase.php +++ b/core/lib/Drupal/Core/Form/FormBase.php @@ -8,7 +8,7 @@ namespace Drupal\Core\Form; use Drupal\Core\Controller\ControllerInterface; -use Drupal\Core\StringTranslation\Translator\TranslatorInterface; +use Drupal\Core\StringTranslation\TranslationInterface; use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\HttpFoundation\Request; @@ -20,7 +20,7 @@ /** * The translation manager service. * - * @var \Drupal\Core\StringTranslation\Translator\TranslatorInterface + * @var \Drupal\Core\StringTranslation\TranslationInterface */ protected $translationManager; @@ -35,7 +35,7 @@ * {@inheritdoc} */ public static function create(ContainerInterface $container) { - return new static; + return new static(); } /** @@ -65,16 +65,16 @@ public function validateForm(array &$form, array &$form_state) { * The translated string. */ protected function t($string, array $args = array(), array $options = array()) { - return $this->translator()->translate($string, $args, $options); + return $this->getTranslationManager()->translate($string, $args, $options); } /** - * Gets the translator object. + * Gets the translation manager. * - * @return \Drupal\Core\StringTranslation\TranslationManager|TranslatorInterface - * The translator object. + * @return \Drupal\Core\StringTranslation\TranslationInterface + * The translation manager. */ - protected function translator() { + protected function getTranslationManager() { if (!$this->translationManager) { $this->translationManager = \Drupal::translation(); } @@ -84,13 +84,13 @@ protected function translator() { /** * Sets the translation manager for this form. * - * @param \Drupal\Core\StringTranslation\Translator\TranslatorInterface $translation_manager + * @param \Drupal\Core\StringTranslation\TranslationInterface $translation_manager * The translation manager. * * @return self * The entity form. */ - public function setTranslationManager(TranslatorInterface $translation_manager) { + public function setTranslationManager(TranslationInterface $translation_manager) { $this->translationManager = $translation_manager; return $this; } diff --git a/core/modules/config/lib/Drupal/config/Form/ConfigSync.php b/core/modules/config/lib/Drupal/config/Form/ConfigSync.php index 76fe775..463590e 100644 --- a/core/modules/config/lib/Drupal/config/Form/ConfigSync.php +++ b/core/modules/config/lib/Drupal/config/Form/ConfigSync.php @@ -9,7 +9,6 @@ use Drupal\Core\Entity\EntityManager; use Drupal\Core\Form\FormBase; -use Drupal\Core\Controller\ControllerInterface; use Drupal\Core\Config\StorageInterface; use Drupal\Core\Lock\LockBackendInterface; use Drupal\Core\Config\StorageComparer; @@ -23,7 +22,7 @@ /** * Construct the storage changes in a configuration synchronization form. */ -class ConfigSync extends FormBase implements ControllerInterface { +class ConfigSync extends FormBase { /** * The database lock object. diff --git a/core/modules/statistics/lib/Drupal/statistics/StatisticsSettingsForm.php b/core/modules/statistics/lib/Drupal/statistics/StatisticsSettingsForm.php index 5bd9199..c2611cd 100644 --- a/core/modules/statistics/lib/Drupal/statistics/StatisticsSettingsForm.php +++ b/core/modules/statistics/lib/Drupal/statistics/StatisticsSettingsForm.php @@ -7,9 +7,9 @@ namespace Drupal\statistics; use Drupal\Core\Config\Context\ContextInterface; +use Drupal\Core\Extension\ModuleHandlerInterface; use Drupal\system\SystemConfigFormBase; use Drupal\Core\Config\ConfigFactory; -use Drupal\Core\Extension\ModuleHandler; use Symfony\Component\DependencyInjection\ContainerInterface; /** @@ -20,7 +20,7 @@ class StatisticsSettingsForm extends SystemConfigFormBase { /** * The module handler. * - * @var \Drupal\Core\Extension\ModuleHandler + * @var \Drupal\Core\Extension\ModuleHandlerInterface */ protected $moduleHandler; @@ -31,10 +31,10 @@ class StatisticsSettingsForm extends SystemConfigFormBase { * The factory for configuration objects. * @param \Drupal\Core\Config\Context\ContextInterface $context * The configuration context to use. - * @param \Drupal\Core\Extension\ModuleHandler $module_handler + * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler * The module handler. */ - public function __construct(ConfigFactory $config_factory, ContextInterface $context, ModuleHandler $module_handler) { + public function __construct(ConfigFactory $config_factory, ContextInterface $context, ModuleHandlerInterface $module_handler) { parent::__construct($config_factory, $context); $this->moduleHandler = $module_handler; diff --git a/core/modules/system/lib/Drupal/system/Form/ModulesListForm.php b/core/modules/system/lib/Drupal/system/Form/ModulesListForm.php index 267b6fd..32d8db7 100644 --- a/core/modules/system/lib/Drupal/system/Form/ModulesListForm.php +++ b/core/modules/system/lib/Drupal/system/Form/ModulesListForm.php @@ -7,11 +7,10 @@ namespace Drupal\system\Form; -use Drupal\Core\Controller\ControllerInterface; +use Drupal\Component\Utility\Unicode; use Drupal\Core\Extension\ModuleHandlerInterface; use Drupal\Core\Form\FormBase; use Drupal\Core\KeyValueStore\KeyValueStoreExpirableInterface; -use Drupal\Component\Utility\Unicode; use Symfony\Component\DependencyInjection\ContainerInterface; /** @@ -22,7 +21,7 @@ * requires. See drupal_parse_info_file() for info on module.info.yml * descriptors. */ -class ModulesListForm extends FormBase implements ControllerInterface { +class ModulesListForm extends FormBase { /** * The module handler service. diff --git a/core/modules/system/lib/Drupal/system/Form/ModulesUninstallForm.php b/core/modules/system/lib/Drupal/system/Form/ModulesUninstallForm.php index 859da70..33e402b 100644 --- a/core/modules/system/lib/Drupal/system/Form/ModulesUninstallForm.php +++ b/core/modules/system/lib/Drupal/system/Form/ModulesUninstallForm.php @@ -7,7 +7,6 @@ namespace Drupal\system\Form; -use Drupal\Core\Controller\ControllerInterface; use Drupal\Core\Extension\ModuleHandlerInterface; use Drupal\Core\Form\FormBase; use Drupal\Core\KeyValueStore\KeyValueStoreExpirableInterface; @@ -16,7 +15,7 @@ /** * Provides a form for uninstalling modules. */ -class ModulesUninstallForm extends FormBase implements ControllerInterface { +class ModulesUninstallForm extends FormBase { /** * The module handler service. diff --git a/core/modules/system/lib/Drupal/system/SystemConfigFormBase.php b/core/modules/system/lib/Drupal/system/SystemConfigFormBase.php index da7a32c..bceca12 100644 --- a/core/modules/system/lib/Drupal/system/SystemConfigFormBase.php +++ b/core/modules/system/lib/Drupal/system/SystemConfigFormBase.php @@ -7,16 +7,15 @@ namespace Drupal\system; -use Drupal\Core\Form\FormBase; -use Drupal\Core\Controller\ControllerInterface; use Drupal\Core\Config\ConfigFactory; use Drupal\Core\Config\Context\ContextInterface; +use Drupal\Core\Form\FormBase; use Symfony\Component\DependencyInjection\ContainerInterface; /** * Base class for implementing system configuration forms. */ -abstract class SystemConfigFormBase extends FormBase implements ControllerInterface { +abstract class SystemConfigFormBase extends FormBase { /** * Stores the configuration factory.