diff --git a/core/composer.json b/core/composer.json index 62c26c4ac5..fa3914c40d 100644 --- a/core/composer.json +++ b/core/composer.json @@ -138,6 +138,7 @@ "drupal/migrate": "self.version", "drupal/migrate_drupal": "self.version", "drupal/migrate_drupal_ui": "self.version", + "drupal/migrate_drupal_i18n": "self.version", "drupal/node": "self.version", "drupal/options": "self.version", "drupal/page_cache": "self.version", diff --git a/core/core.api.php b/core/core.api.php index 552b9c9032..5045fc55fa 100644 --- a/core/core.api.php +++ b/core/core.api.php @@ -1252,11 +1252,9 @@ * using @link entity_api Entities @endlink. * - Session: Information about individual users' interactions with the site, * such as whether they are logged in. This is really "state" information, but - * it is not stored the same way so it's a separate type here. Session data is - * accessed via \Symfony\Component\HttpFoundation\Request::getSession(), which - * returns an instance of + * it is not stored the same way so it's a separate type here. Session + * information is available from the Request object. The session implements * \Symfony\Component\HttpFoundation\Session\SessionInterface. - * See the @link session Sessions topic @endlink for more information. * - State: Information of a temporary nature, generally machine-generated and * not human-edited, about the current state of your site. Examples: the time * when Cron was last run, whether node access permissions need rebuilding, @@ -2587,64 +2585,3 @@ function hook_validation_constraint_alter(array &$definitions) { * minor release. * @} */ - -/** - * @defgroup session Sessions - * @{ - * Store and retrieve data associated with a user's browsing session. - * - * @section sec_intro Overview - * The Drupal session management subsystem is built on top of the Symfony - * session component. It is optimized in order to minimize the impact of - * anonymous sessions on caching proxies. A session is only started if necessary - * and the session cookie is removed from the browser as soon as the session - * has no data. For this reason it is important for contributed and custom - * code to remove session data if it is not used anymore. - * - * @section sec_usage Usage - * Session data is accessed via the - * \Symfony\Component\HttpFoundation\Request::getSession() - * method, which returns an instance of - * \Symfony\Component\HttpFoundation\Session\SessionInterface. The most - * important methods on SessionInterface are set(), get(), and remove(). - * - * The following code fragment shows the implementation of a counter controller - * relying on the session: - * @code - * public function counter(Request $request) { - * $session = $request->getSession(); - * $count = $session->get('mymodule.counter', 0) + 1; - * $session->set('mymodule.counter', $count); - * - * return [ - * '#markup' => $this->t('Page Views: @count', ['@count' => $count]), - * '#cache' => [ - * 'max-age' => 0, - * ], - * ]; - * } - * - * public function reset(Request $request) { - * $session = $request->getSession(); - * $session->remove('mymodule.counter'); - * } - * @endcode - * - * It is important to keep the amount of data stored inside the session to a - * minimum, as the complete session is loaded on every request. Also third - * party session storage backends do not necessarily allow objects of unlimited - * size. If it is necessary to collect a non-trivial amount of data specific to - * a user's session, use the Key/Value store to save the serialized data and - * only store the key to the entry in the session. - * - * @section sec_reserved Reserved attributes and namespacing - * Contributed modules relying on the session are encouraged to namespace - * session attributes by prefixing them with their project name or an - * abbreviation thereof. - * - * Some attributes are reserved for Drupal core and must not be accessed from - * within contributed and custom code. Reserved attributes include: - * - uid: The user ID for an authenticated user. The value of this attribute - * cannot be modified. - * @} - */ diff --git a/core/lib/Drupal/Core/Plugin/Discovery/ContainerDerivativeDiscoveryDecorator.php b/core/lib/Drupal/Core/Plugin/Discovery/ContainerDerivativeDiscoveryDecorator.php index f6908b66e9..017348e10f 100644 --- a/core/lib/Drupal/Core/Plugin/Discovery/ContainerDerivativeDiscoveryDecorator.php +++ b/core/lib/Drupal/Core/Plugin/Discovery/ContainerDerivativeDiscoveryDecorator.php @@ -4,11 +4,6 @@ use Drupal\Component\Plugin\Discovery\DerivativeDiscoveryDecorator; -/** - * Injects dependencies into derivers if they use ContainerDeriverInterface. - * - * @see \Drupal\Core\Plugin\Discovery\ContainerDeriverInterface - */ class ContainerDerivativeDiscoveryDecorator extends DerivativeDiscoveryDecorator { /** diff --git a/core/modules/config/tests/config_override_test/src/PirateDayCacheabilityMetadataConfigOverride.php b/core/modules/config/tests/config_override_test/src/PirateDayCacheabilityMetadataConfigOverride.php index 8610eadeea..cfe306a7b8 100644 --- a/core/modules/config/tests/config_override_test/src/PirateDayCacheabilityMetadataConfigOverride.php +++ b/core/modules/config/tests/config_override_test/src/PirateDayCacheabilityMetadataConfigOverride.php @@ -61,4 +61,17 @@ public function getCacheableMetadata($name) { return $metadata; } + /** + * Returns whether or not our overrides are potentially applicable. + * + * @param string $name + * The name of the config object that is being constructed. + * + * @return bool + * TRUE if the merchant ship will be boarded. FALSE if we drink rum instead. + */ + protected function isCacheabilityMetadataApplicable($name) { + return in_array($name, ['system.theme', 'block.block.call_to_action']); + } + } diff --git a/core/modules/config_translation/src/Plugin/migrate/source/d6/ProfileFieldTranslation.php b/core/modules/config_translation/src/Plugin/migrate/source/d6/ProfileFieldTranslation.php index c0e8447c74..0db0692dae 100644 --- a/core/modules/config_translation/src/Plugin/migrate/source/d6/ProfileFieldTranslation.php +++ b/core/modules/config_translation/src/Plugin/migrate/source/d6/ProfileFieldTranslation.php @@ -14,7 +14,7 @@ */ class ProfileFieldTranslation extends DrupalSqlBase { - /** + /** * {@inheritdoc} */ public function query() { diff --git a/core/modules/config_translation/tests/src/Kernel/Migrate/d6/MigrateSystemMaintenanceTranslationTest.php b/core/modules/config_translation/tests/src/Kernel/Migrate/d6/MigrateSystemMaintenanceTranslationTest.php index 37cd4a9ec2..8d64a7ba18 100644 --- a/core/modules/config_translation/tests/src/Kernel/Migrate/d6/MigrateSystemMaintenanceTranslationTest.php +++ b/core/modules/config_translation/tests/src/Kernel/Migrate/d6/MigrateSystemMaintenanceTranslationTest.php @@ -12,7 +12,11 @@ */ class MigrateSystemMaintenanceTranslationTest extends MigrateDrupal6TestBase { - public static $modules = ['language', 'config_translation']; + public static $modules = [ + 'language', + 'config_translation', + 'migrate_drupal_i18n', + ]; /** * {@inheritdoc} diff --git a/core/modules/config_translation/tests/src/Kernel/Migrate/d6/MigrateSystemSiteTranslationTest.php b/core/modules/config_translation/tests/src/Kernel/Migrate/d6/MigrateSystemSiteTranslationTest.php index 326e1bb7e4..daaf538767 100644 --- a/core/modules/config_translation/tests/src/Kernel/Migrate/d6/MigrateSystemSiteTranslationTest.php +++ b/core/modules/config_translation/tests/src/Kernel/Migrate/d6/MigrateSystemSiteTranslationTest.php @@ -12,7 +12,11 @@ */ class MigrateSystemSiteTranslationTest extends MigrateDrupal6TestBase { - public static $modules = ['language', 'config_translation']; + public static $modules = [ + 'language', + 'config_translation', + 'migrate_drupal_i18n', + ]; /** * {@inheritdoc} diff --git a/core/modules/config_translation/tests/src/Kernel/Migrate/d6/MigrateUserConfigsTranslationTest.php b/core/modules/config_translation/tests/src/Kernel/Migrate/d6/MigrateUserConfigsTranslationTest.php index bc622e1b6a..09e1d3dea9 100644 --- a/core/modules/config_translation/tests/src/Kernel/Migrate/d6/MigrateUserConfigsTranslationTest.php +++ b/core/modules/config_translation/tests/src/Kernel/Migrate/d6/MigrateUserConfigsTranslationTest.php @@ -15,7 +15,12 @@ class MigrateUserConfigsTranslationTest extends MigrateDrupal6TestBase { use SchemaCheckTestTrait; - public static $modules = ['language', 'locale', 'config_translation']; + public static $modules = [ + 'language', + 'locale', + 'config_translation', + 'migrate_drupal_i18n', + ]; /** * {@inheritdoc} diff --git a/core/modules/config_translation/tests/src/Kernel/Migrate/d6/MigrateUserProfileFieldInstanceTranslationTest.php b/core/modules/config_translation/tests/src/Kernel/Migrate/d6/MigrateUserProfileFieldInstanceTranslationTest.php index 01d5ec929d..b281a901cf 100644 --- a/core/modules/config_translation/tests/src/Kernel/Migrate/d6/MigrateUserProfileFieldInstanceTranslationTest.php +++ b/core/modules/config_translation/tests/src/Kernel/Migrate/d6/MigrateUserProfileFieldInstanceTranslationTest.php @@ -15,7 +15,13 @@ class MigrateUserProfileFieldInstanceTranslationTest extends MigrateDrupal6TestB /** * {@inheritdoc} */ - public static $modules = ['config_translation', 'locale', 'language', 'field']; + public static $modules = [ + 'config_translation', + 'locale', + 'language', + 'field', + 'migrate_drupal_i18n', + ]; /** * Tests migration of translated user profile fields. diff --git a/core/modules/content_translation/migrations/d6_taxonomy_term_translation.yml b/core/modules/content_translation/migrations/d6_taxonomy_term_translation.yml index 0b42dcfdb9..29aacf98de 100644 --- a/core/modules/content_translation/migrations/d6_taxonomy_term_translation.yml +++ b/core/modules/content_translation/migrations/d6_taxonomy_term_translation.yml @@ -5,7 +5,7 @@ migration_tags: - Content source: plugin: d6_taxonomy_term - translations: true + translations: i18n process: # If you are using this file to build a custom migration consider removing # the tid field to allow incremental migrations. diff --git a/core/modules/dynamic_page_cache/src/EventSubscriber/DynamicPageCacheSubscriber.php b/core/modules/dynamic_page_cache/src/EventSubscriber/DynamicPageCacheSubscriber.php index e99caa1b89..8316470876 100644 --- a/core/modules/dynamic_page_cache/src/EventSubscriber/DynamicPageCacheSubscriber.php +++ b/core/modules/dynamic_page_cache/src/EventSubscriber/DynamicPageCacheSubscriber.php @@ -122,7 +122,7 @@ public function __construct(RequestPolicyInterface $request_policy, ResponsePoli * @param \Symfony\Component\HttpKernel\Event\GetResponseEvent $event * The event to process. */ - public function onRequest(GetResponseEvent $event) { + public function onRouteMatch(GetResponseEvent $event) { // Don't cache the response if the Dynamic Page Cache request policies are // not met. Store the result in a static keyed by current request, so that // onResponse() does not have to redo the request policy check. @@ -189,7 +189,7 @@ public function onResponse(FilterResponseEvent $event) { // Don't cache the response if the Dynamic Page Cache request & response // policies are not met. - // @see onRequest() + // @see onRouteMatch() if ($this->requestPolicyResults[$request] === RequestPolicyInterface::DENY || $this->responsePolicy->check($response, $request) === ResponsePolicyInterface::DENY) { return; } @@ -312,7 +312,7 @@ public static function getSubscribedEvents() { // should not be polluted by maintenance mode-specific behavior; priority // 30), but before ContentControllerSubscriber (updates _controller, but // that is a no-op when Dynamic Page Cache runs; priority 25). - $events[KernelEvents::REQUEST][] = ['onRequest', 27]; + $events[KernelEvents::REQUEST][] = ['onRouteMatch', 27]; // Run before HtmlResponseSubscriber::onRespond(), which has priority 0. $events[KernelEvents::RESPONSE][] = ['onResponse', 100]; diff --git a/core/modules/layout_builder/css/layout-builder.css b/core/modules/layout_builder/css/layout-builder.css index ed2fb3b412..9d4bc909c3 100644 --- a/core/modules/layout_builder/css/layout-builder.css +++ b/core/modules/layout_builder/css/layout-builder.css @@ -1,5 +1,4 @@ .add-section { - background-color: #f7f7f7; width: 100%; outline: 2px dashed #979797; padding: 1.5em 0; @@ -8,54 +7,19 @@ transition: visually-hidden 2s ease-out, height 2s ease-in; } -.add-section__link, -.add-block__link { - color: #787878; - border-bottom: none; - padding-left: 24px; - background: url(../../../misc/icons/787878/plus.svg) transparent top left / 16px 16px no-repeat; -} - -.add-section__link:hover, -.add-section__link:active, -.add-section__link:focus, -.add-block__link:hover, -.add-block__link:active, -.add-block__link:focus { - border-bottom-style: none; - color: #000; -} - .layout-section { margin-bottom: 1.5em; } -.layout-section .ui-sortable-helper { - background-color: #fff; - outline: 2px solid #f7f7f7; -} - -.layout-section .ui-state-drop { - background-color: #ffd; - outline: 2px dashed #fedb60; - margin: 20px; - padding: 30px; -} - .layout-section .layout-builder--layout__region { outline: 2px dashed #2f91da; + padding: 1.5em 0; } .layout-section .layout-builder--layout__region .add-block { - background-color: #eff6fc; - padding: 1.5em 0; text-align: center; } -.layout-section .layout-builder--layout__region .block { - padding: 1.5em; -} - .layout-section .remove-section { position: relative; background: url(../../../misc/icons/bebebe/ex.svg) #fff center center / 16px 16px no-repeat; diff --git a/core/modules/layout_builder/js/layout-builder.es6.js b/core/modules/layout_builder/js/layout-builder.es6.js index e19d93400b..cdb5bee762 100644 --- a/core/modules/layout_builder/js/layout-builder.es6.js +++ b/core/modules/layout_builder/js/layout-builder.es6.js @@ -4,7 +4,6 @@ $(context).find('.layout-builder--layout__region').sortable({ items: '> .draggable', connectWith: '.layout-builder--layout__region', - placeholder: 'ui-state-drop', /** * Updates the layout with the new position of the block. diff --git a/core/modules/layout_builder/js/layout-builder.js b/core/modules/layout_builder/js/layout-builder.js index 0f0de275ef..661c5e3d84 100644 --- a/core/modules/layout_builder/js/layout-builder.js +++ b/core/modules/layout_builder/js/layout-builder.js @@ -14,7 +14,6 @@ $(context).find('.layout-builder--layout__region').sortable({ items: '> .draggable', connectWith: '.layout-builder--layout__region', - placeholder: 'ui-state-drop', update: function update(event, ui) { var itemRegion = ui.item.closest('.layout-builder--layout__region'); diff --git a/core/modules/layout_builder/src/Controller/AddSectionController.php b/core/modules/layout_builder/src/Controller/AddSectionController.php index 0ea42379a6..947895985c 100644 --- a/core/modules/layout_builder/src/Controller/AddSectionController.php +++ b/core/modules/layout_builder/src/Controller/AddSectionController.php @@ -2,7 +2,6 @@ namespace Drupal\layout_builder\Controller; -use Drupal\Core\Ajax\AjaxHelperTrait; use Drupal\Core\DependencyInjection\ClassResolverInterface; use Drupal\Core\DependencyInjection\ContainerInjectionInterface; use Drupal\layout_builder\LayoutTempstoreRepositoryInterface; diff --git a/core/lib/Drupal/Core/Ajax/AjaxHelperTrait.php b/core/modules/layout_builder/src/Controller/AjaxHelperTrait.php similarity index 68% rename from core/lib/Drupal/Core/Ajax/AjaxHelperTrait.php rename to core/modules/layout_builder/src/Controller/AjaxHelperTrait.php index 287abae321..072eccab35 100644 --- a/core/lib/Drupal/Core/Ajax/AjaxHelperTrait.php +++ b/core/modules/layout_builder/src/Controller/AjaxHelperTrait.php @@ -1,6 +1,6 @@ getRequestWrapperFormat(), $wrapper) !== FALSE) { - return TRUE; - } - } - return FALSE; + return in_array($this->getRequestWrapperFormat(), [ + 'drupal_ajax', + 'drupal_dialog', + 'drupal_dialog.off_canvas', + 'drupal_modal', + ]); } /** diff --git a/core/modules/layout_builder/src/Controller/ChooseBlockController.php b/core/modules/layout_builder/src/Controller/ChooseBlockController.php index 85ea7d8370..5287be25fc 100644 --- a/core/modules/layout_builder/src/Controller/ChooseBlockController.php +++ b/core/modules/layout_builder/src/Controller/ChooseBlockController.php @@ -2,7 +2,6 @@ namespace Drupal\layout_builder\Controller; -use Drupal\Core\Ajax\AjaxHelperTrait; use Drupal\Core\Block\BlockManagerInterface; use Drupal\Core\DependencyInjection\ContainerInjectionInterface; use Drupal\Core\Url; diff --git a/core/modules/layout_builder/src/Controller/ChooseSectionController.php b/core/modules/layout_builder/src/Controller/ChooseSectionController.php index 488480883d..a04cdbb1c1 100644 --- a/core/modules/layout_builder/src/Controller/ChooseSectionController.php +++ b/core/modules/layout_builder/src/Controller/ChooseSectionController.php @@ -2,7 +2,6 @@ namespace Drupal\layout_builder\Controller; -use Drupal\Core\Ajax\AjaxHelperTrait; use Drupal\Core\DependencyInjection\ContainerInjectionInterface; use Drupal\Core\Layout\LayoutPluginManagerInterface; use Drupal\Core\Plugin\PluginFormInterface; diff --git a/core/modules/layout_builder/src/Controller/LayoutBuilderController.php b/core/modules/layout_builder/src/Controller/LayoutBuilderController.php index 3ddd352e89..8f7666f579 100644 --- a/core/modules/layout_builder/src/Controller/LayoutBuilderController.php +++ b/core/modules/layout_builder/src/Controller/LayoutBuilderController.php @@ -161,7 +161,7 @@ protected function buildAddSectionLink(SectionStorageInterface $section_storage, ], [ 'attributes' => [ - 'class' => ['use-ajax', 'add-section__link'], + 'class' => ['use-ajax'], 'data-dialog-type' => 'dialog', 'data-dialog-renderer' => 'off_canvas', ], @@ -226,7 +226,7 @@ protected function buildAdministrativeSection(SectionStorageInterface $section_s ], [ 'attributes' => [ - 'class' => ['use-ajax', 'add-block__link'], + 'class' => ['use-ajax'], 'data-dialog-type' => 'dialog', 'data-dialog-renderer' => 'off_canvas', ], diff --git a/core/lib/Drupal/Core/Ajax/AjaxFormHelperTrait.php b/core/modules/layout_builder/src/Form/AjaxFormHelperTrait.php similarity index 86% rename from core/lib/Drupal/Core/Ajax/AjaxFormHelperTrait.php rename to core/modules/layout_builder/src/Form/AjaxFormHelperTrait.php index 49932df548..a5a387020f 100644 --- a/core/lib/Drupal/Core/Ajax/AjaxFormHelperTrait.php +++ b/core/modules/layout_builder/src/Form/AjaxFormHelperTrait.php @@ -1,13 +1,18 @@ pluginDefinition['requirements_met'] === TRUE) { + + // For i18n translations migrate_drupal_i18n must be enabled. + if (strpos($this->getSourceModule(), 'i18n') !== false) { + if (!\Drupal::service('module_handler') + ->moduleExists('migrate_drupal_i18n')) { + throw new RequirementsException("The module migrate_drupal_i18n is not enabled on the new site."); + } + } + if (isset($this->pluginDefinition['source_module'])) { if ($this->moduleExists($this->pluginDefinition['source_module'])) { if (isset($this->pluginDefinition['minimum_schema_version']) && !$this->getModuleSchemaVersion($this->pluginDefinition['source_module']) < $this->pluginDefinition['minimum_schema_version']) { diff --git a/core/modules/migrate_drupal_i18n/migrate_drupal_i18n.info.yml b/core/modules/migrate_drupal_i18n/migrate_drupal_i18n.info.yml new file mode 100644 index 0000000000..ad5bc63965 --- /dev/null +++ b/core/modules/migrate_drupal_i18n/migrate_drupal_i18n.info.yml @@ -0,0 +1,8 @@ +name: 'Migrate Drupal i18n' +type: module +description: 'Provides a requirement for all i18n migrations.' +package: 'Core (Experimental)' +core: 8.x +dependencies: + - migrate + - migrate_drupal diff --git a/core/modules/migrate_drupal_ui/tests/src/Functional/d6/MigrateUpgrade6ReviewPageTest.php b/core/modules/migrate_drupal_ui/tests/src/Functional/d6/MigrateUpgrade6ReviewPageTest.php index a526de77e9..3cdc82dd36 100644 --- a/core/modules/migrate_drupal_ui/tests/src/Functional/d6/MigrateUpgrade6ReviewPageTest.php +++ b/core/modules/migrate_drupal_ui/tests/src/Functional/d6/MigrateUpgrade6ReviewPageTest.php @@ -44,7 +44,6 @@ protected function getAvailablePaths() { 'filefield', 'filter', 'forum', - 'i18ntaxonomy', 'imagecache', 'imagefield', 'language', @@ -127,6 +126,7 @@ protected function getMissingPaths() { 'i18npoll', 'i18nprofile', 'i18nsync', + 'i18ntaxonomy', 'i18nviews', 'phone', 'views', diff --git a/core/modules/migrate_drupal_ui/tests/src/Functional/d6/MigrateUpgrade6ReviewPageTest.php b/core/modules/migrate_drupal_ui/tests/src/Functional/d6/MigrateUpgrade6ReviewPagei18nTest.php similarity index 83% copy from core/modules/migrate_drupal_ui/tests/src/Functional/d6/MigrateUpgrade6ReviewPageTest.php copy to core/modules/migrate_drupal_ui/tests/src/Functional/d6/MigrateUpgrade6ReviewPagei18nTest.php index a526de77e9..2600c8466b 100644 --- a/core/modules/migrate_drupal_ui/tests/src/Functional/d6/MigrateUpgrade6ReviewPageTest.php +++ b/core/modules/migrate_drupal_ui/tests/src/Functional/d6/MigrateUpgrade6ReviewPagei18nTest.php @@ -2,30 +2,20 @@ namespace Drupal\Tests\migrate_drupal_ui\Functional\d6; -use Drupal\Tests\migrate_drupal_ui\Functional\MigrateUpgradeReviewPageTestBase; - /** * Tests migrate upgrade review page for Drupal 6. * * @group migrate_drupal_6 * @group migrate_drupal_ui */ -class MigrateUpgrade6ReviewPageTest extends MigrateUpgradeReviewPageTestBase { +class MigrateUpgrade6ReviewPagei18nTest extends MigrateUpgrade6ReviewPageTest { /** * {@inheritdoc} */ - protected function setUp() { - parent::setUp(); - $this->loadFixture(drupal_get_path('module', 'migrate_drupal') . '/tests/fixtures/drupal6.php'); - } - - /** - * {@inheritdoc} - */ - protected function getSourceBasePath() { - return __DIR__ . '/files'; - } + public static $modules = [ + 'migrate_drupal_i18n', + ]; /** * {@inheritdoc} diff --git a/core/modules/migrate_drupal_ui/tests/src/Functional/d6/MigrateUpgrade6Test.php b/core/modules/migrate_drupal_ui/tests/src/Functional/d6/MigrateUpgrade6Test.php index 841b27c310..0477b78f6b 100644 --- a/core/modules/migrate_drupal_ui/tests/src/Functional/d6/MigrateUpgrade6Test.php +++ b/core/modules/migrate_drupal_ui/tests/src/Functional/d6/MigrateUpgrade6Test.php @@ -81,7 +81,7 @@ protected function getEntityCounts() { 'action' => 23, 'menu' => 8, 'taxonomy_term' => 8, - 'taxonomy_vocabulary' => 7, + 'taxonomy_vocabulary' => 6, 'tour' => 4, 'user' => 7, 'user_role' => 6, @@ -131,7 +131,6 @@ protected function getAvailablePaths() { 'filefield', 'filter', 'forum', - 'i18ntaxonomy', 'imagecache', 'imagefield', 'language', @@ -179,6 +178,7 @@ protected function getMissingPaths() { // This module is in the missing path list because it is installed on the // source site but it is not installed on the destination site. 'i18nprofile', + 'i18ntaxonomy', ]; } diff --git a/core/modules/migrate_drupal_ui/tests/src/Functional/d6/MigrateUpgrade6Test.php b/core/modules/migrate_drupal_ui/tests/src/Functional/d6/MigrateUpgrade6i18nTest.php similarity index 81% copy from core/modules/migrate_drupal_ui/tests/src/Functional/d6/MigrateUpgrade6Test.php copy to core/modules/migrate_drupal_ui/tests/src/Functional/d6/MigrateUpgrade6i18nTest.php index 841b27c310..5edfb7d397 100644 --- a/core/modules/migrate_drupal_ui/tests/src/Functional/d6/MigrateUpgrade6Test.php +++ b/core/modules/migrate_drupal_ui/tests/src/Functional/d6/MigrateUpgrade6i18nTest.php @@ -12,7 +12,7 @@ * * @group migrate_drupal_ui */ -class MigrateUpgrade6Test extends MigrateUpgradeExecuteTestBase { +class MigrateUpgrade6i18nTest extends MigrateUpgrade6Test { /** * Modules to enable. @@ -20,35 +20,12 @@ class MigrateUpgrade6Test extends MigrateUpgradeExecuteTestBase { * @var array */ public static $modules = [ - 'language', - 'content_translation', - 'migrate_drupal_ui', - 'telephone', - 'aggregator', - 'book', - 'forum', - 'statistics', - 'migration_provider_test', + 'migrate_drupal_i18n', ]; /** * {@inheritdoc} */ - protected function setUp() { - parent::setUp(); - $this->loadFixture(drupal_get_path('module', 'migrate_drupal') . '/tests/fixtures/drupal6.php'); - } - - /** - * {@inheritdoc} - */ - protected function getSourceBasePath() { - return __DIR__ . '/files'; - } - - /** - * {@inheritdoc} - */ protected function getEntityCounts() { return [ 'aggregator_item' => 1, @@ -182,16 +159,4 @@ protected function getMissingPaths() { ]; } - /** - * Executes all steps of migrations upgrade. - */ - public function testMigrateUpgradeExecute() { - parent::testMigrateUpgradeExecute(); - - // Ensure migrated users can log in. - $user = User::load(2); - $user->passRaw = 'john.doe_pass'; - $this->drupalLogin($user); - } - } diff --git a/core/modules/node/tests/src/Functional/Migrate/d6/MigrateNodeRevisionTest.php b/core/modules/node/tests/src/Functional/Migrate/d6/MigrateNodeRevisionTest.php index 075e727678..c4ad3bd154 100644 --- a/core/modules/node/tests/src/Functional/Migrate/d6/MigrateNodeRevisionTest.php +++ b/core/modules/node/tests/src/Functional/Migrate/d6/MigrateNodeRevisionTest.php @@ -14,7 +14,12 @@ class MigrateNodeRevisionTest extends MigrateNodeTestBase { /** * {@inheritdoc} */ - public static $modules = ['language', 'content_translation', 'menu_ui']; + public static $modules = [ + 'language', + 'content_translation', + 'menu_ui', + 'migrate_drupal_i18n', + ]; /** * {@inheritdoc} diff --git a/core/modules/node/tests/src/Kernel/Migrate/d6/MigrateNodeTest.php b/core/modules/node/tests/src/Kernel/Migrate/d6/MigrateNodeTest.php index 29460d9c74..afeba89d15 100644 --- a/core/modules/node/tests/src/Kernel/Migrate/d6/MigrateNodeTest.php +++ b/core/modules/node/tests/src/Kernel/Migrate/d6/MigrateNodeTest.php @@ -19,7 +19,12 @@ class MigrateNodeTest extends MigrateNodeTestBase { /** * {@inheritdoc} */ - public static $modules = ['language', 'content_translation', 'menu_ui']; + public static $modules = [ + 'language', + 'content_translation', + 'menu_ui', + 'migrate_drupal_i18n', + ]; /** * {@inheritdoc} @@ -33,6 +38,7 @@ protected function setUp() { 'd6_language_content_settings', 'd6_node', 'd6_node_translation', + 'migrate_drupal_i18n', ]); } diff --git a/core/modules/node/tests/src/Kernel/Migrate/d6/NodeTranslationRedirectTest.php b/core/modules/node/tests/src/Kernel/Migrate/d6/NodeTranslationRedirectTest.php index 7daac88309..b402f4c615 100644 --- a/core/modules/node/tests/src/Kernel/Migrate/d6/NodeTranslationRedirectTest.php +++ b/core/modules/node/tests/src/Kernel/Migrate/d6/NodeTranslationRedirectTest.php @@ -20,6 +20,7 @@ class NodeTranslationRedirectTest extends MigrateDrupal6TestBase { 'content_translation', 'language', 'menu_ui', + 'migrate_drupal_i18n', ]; /** diff --git a/core/modules/node/tests/src/Kernel/Migrate/d7/MigrateNodeTest.php b/core/modules/node/tests/src/Kernel/Migrate/d7/MigrateNodeTest.php index bb62e90e24..b6a7f8bc67 100644 --- a/core/modules/node/tests/src/Kernel/Migrate/d7/MigrateNodeTest.php +++ b/core/modules/node/tests/src/Kernel/Migrate/d7/MigrateNodeTest.php @@ -35,6 +35,7 @@ class MigrateNodeTest extends MigrateDrupal7TestBase { 'taxonomy', 'telephone', 'text', + 'migrate_drupal_i18n', ]; /** diff --git a/core/modules/node/tests/src/Kernel/Migrate/d7/NodeTranslationRedirectTest.php b/core/modules/node/tests/src/Kernel/Migrate/d7/NodeTranslationRedirectTest.php index 88cc2ade7b..3d98ad881b 100644 --- a/core/modules/node/tests/src/Kernel/Migrate/d7/NodeTranslationRedirectTest.php +++ b/core/modules/node/tests/src/Kernel/Migrate/d7/NodeTranslationRedirectTest.php @@ -22,6 +22,7 @@ class NodeTranslationRedirectTest extends MigrateDrupal7TestBase { 'menu_ui', 'node', 'text', + 'migrate_drupal_i18n', ]; /** diff --git a/core/modules/node/tests/src/Kernel/Plugin/migrate/source/d7/NodeTranslationTest.php b/core/modules/node/tests/src/Kernel/Plugin/migrate/source/d7/NodeTranslationTest.php index e46bd35a33..497d9b4a7c 100644 --- a/core/modules/node/tests/src/Kernel/Plugin/migrate/source/d7/NodeTranslationTest.php +++ b/core/modules/node/tests/src/Kernel/Plugin/migrate/source/d7/NodeTranslationTest.php @@ -14,7 +14,12 @@ class NodeTranslationTest extends NodeTest { /** * {@inheritdoc} */ - public static $modules = ['node', 'user', 'migrate_drupal']; + public static $modules = [ + 'node', + 'user', + 'migrate_drupal', + 'migrate_drupal_i18n', + ]; /** * {@inheritdoc} diff --git a/core/modules/path/tests/src/Kernel/Migrate/d6/MigrateUrlAliasTest.php b/core/modules/path/tests/src/Kernel/Migrate/d6/MigrateUrlAliasTest.php index 0b22cc3ae4..f3bc83187a 100644 --- a/core/modules/path/tests/src/Kernel/Migrate/d6/MigrateUrlAliasTest.php +++ b/core/modules/path/tests/src/Kernel/Migrate/d6/MigrateUrlAliasTest.php @@ -16,7 +16,13 @@ class MigrateUrlAliasTest extends MigrateDrupal6TestBase { /** * {@inheritdoc} */ - public static $modules = ['language', 'content_translation', 'path', 'menu_ui']; + public static $modules = [ + 'language', + 'content_translation', + 'path', + 'menu_ui', + 'migrate_drupal_i18n', + ]; /** * {@inheritdoc} diff --git a/core/modules/path/tests/src/Kernel/Migrate/d7/MigrateUrlAliasTest.php b/core/modules/path/tests/src/Kernel/Migrate/d7/MigrateUrlAliasTest.php index dae0249500..0d236ae122 100644 --- a/core/modules/path/tests/src/Kernel/Migrate/d7/MigrateUrlAliasTest.php +++ b/core/modules/path/tests/src/Kernel/Migrate/d7/MigrateUrlAliasTest.php @@ -21,6 +21,7 @@ class MigrateUrlAliasTest extends MigrateDrupal7TestBase { 'node', 'path', 'text', + 'migrate_drupal_i18n', ]; /** diff --git a/core/modules/serialization/src/Encoder/XmlEncoder.php b/core/modules/serialization/src/Encoder/XmlEncoder.php index e41f52b957..125a2cc30d 100644 --- a/core/modules/serialization/src/Encoder/XmlEncoder.php +++ b/core/modules/serialization/src/Encoder/XmlEncoder.php @@ -4,9 +4,8 @@ use Symfony\Component\Serializer\Encoder\EncoderInterface; use Symfony\Component\Serializer\Encoder\DecoderInterface; +use Symfony\Component\Serializer\Encoder\SerializerAwareEncoder; use Symfony\Component\Serializer\Encoder\XmlEncoder as BaseXmlEncoder; -use Symfony\Component\Serializer\SerializerAwareInterface; -use Symfony\Component\Serializer\SerializerAwareTrait; /** * Adds XML support for serializer. @@ -18,9 +17,7 @@ * This encoder should not be used directly. Rather, use the `serializer` * service. */ -class XmlEncoder implements SerializerAwareInterface, EncoderInterface, DecoderInterface { - - use SerializerAwareTrait; +class XmlEncoder extends SerializerAwareEncoder implements EncoderInterface, DecoderInterface { /** * The formats that this Encoder supports. diff --git a/core/modules/serialization/src/Normalizer/NormalizerBase.php b/core/modules/serialization/src/Normalizer/NormalizerBase.php index 8792e5088d..8779b1a1b6 100644 --- a/core/modules/serialization/src/Normalizer/NormalizerBase.php +++ b/core/modules/serialization/src/Normalizer/NormalizerBase.php @@ -3,15 +3,12 @@ namespace Drupal\serialization\Normalizer; use Drupal\Core\Cache\CacheableDependencyInterface; -use Symfony\Component\Serializer\SerializerAwareInterface; -use Symfony\Component\Serializer\SerializerAwareTrait; +use Symfony\Component\Serializer\Normalizer\SerializerAwareNormalizer; /** * Base class for Normalizers. */ -abstract class NormalizerBase implements SerializerAwareInterface, CacheableNormalizerInterface { - - use SerializerAwareTrait; +abstract class NormalizerBase extends SerializerAwareNormalizer implements CacheableNormalizerInterface { /** * The interface or class that this Normalizer supports. diff --git a/core/modules/settings_tray/src/Block/BlockEntitySettingTrayForm.php b/core/modules/settings_tray/src/Block/BlockEntitySettingTrayForm.php index 243e907ccd..fd44b0c86a 100644 --- a/core/modules/settings_tray/src/Block/BlockEntitySettingTrayForm.php +++ b/core/modules/settings_tray/src/Block/BlockEntitySettingTrayForm.php @@ -5,9 +5,9 @@ use Drupal\block\BlockForm; use Drupal\block\BlockInterface; use Drupal\Component\Utility\Html; -use Drupal\Core\Ajax\AjaxFormHelperTrait; use Drupal\Core\Ajax\AjaxResponse; use Drupal\Core\Ajax\RedirectCommand; +use Drupal\Core\Ajax\ReplaceCommand; use Drupal\Core\Block\BlockPluginInterface; use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Plugin\PluginWithFormsInterface; @@ -23,8 +23,6 @@ */ class BlockEntitySettingTrayForm extends BlockForm { - use AjaxFormHelperTrait; - /** * Provides a title callback to get the block's admin label. * @@ -124,17 +122,17 @@ protected function getPluginForm(BlockPluginInterface $block) { public function buildForm(array $form, FormStateInterface $form_state) { $form = parent::buildForm($form, $form_state); $form['actions']['submit']['#ajax'] = [ - 'callback' => '::ajaxSubmit', + 'callback' => '::submitFormDialog', ]; $form['#attached']['library'][] = 'core/drupal.dialog.ajax'; - // static::ajaxSubmit() requires data-drupal-selector to be the same between - // the various Ajax requests. A bug in \Drupal\Core\Form\FormBuilder - // prevents that from happening unless $form['#id'] is also the same. - // Normally, #id is set to a unique HTML ID via Html::getUniqueId(), but - // here we bypass that in order to work around the data-drupal-selector bug. - // This is okay so long as we assume that this form only ever occurs once on - // a page. + // static::submitFormDialog() requires data-drupal-selector to be the same + // between the various Ajax requests. A bug in + // \Drupal\Core\Form\FormBuilder prevents that from happening unless + // $form['#id'] is also the same. Normally, #id is set to a unique HTML ID + // via Html::getUniqueId(), but here we bypass that in order to work around + // the data-drupal-selector bug. This is okay so long as we assume that this + // form only ever occurs once on a page. // @todo Remove this workaround once https://www.drupal.org/node/2897377 is // fixed. $form['#id'] = Html::getId($form_state->getBuildInfo()['form_id']); @@ -143,17 +141,38 @@ public function buildForm(array $form, FormStateInterface $form_state) { } /** - * {@inheritdoc} + * Submit form dialog #ajax callback. + * + * @param array $form + * An associative array containing the structure of the form. + * @param \Drupal\Core\Form\FormStateInterface $form_state + * The current state of the form. + * + * @return \Drupal\Core\Ajax\AjaxResponse + * An AJAX response that display validation error messages or redirects + * to a URL + * + * @todo Repalce this callback with generic trait in + * https://www.drupal.org/node/2896535. */ - protected function successfulAjaxSubmit(array $form, FormStateInterface $form_state) { - if ($redirect_url = $this->getRedirectUrl()) { - $command = new RedirectCommand($redirect_url->setAbsolute()->toString()); + public function submitFormDialog(array &$form, FormStateInterface $form_state) { + $response = new AjaxResponse(); + if ($form_state->hasAnyErrors()) { + $form['status_messages'] = [ + '#type' => 'status_messages', + '#weight' => -1000, + ]; + $command = new ReplaceCommand('[data-drupal-selector="' . $form['#attributes']['data-drupal-selector'] . '"]', $form); } else { - // Settings Tray always provides a destination. - throw new \Exception("No destination provided by Settings Tray form"); + if ($redirect_url = $this->getRedirectUrl()) { + $command = new RedirectCommand($redirect_url->setAbsolute()->toString()); + } + else { + // Settings Tray always provides a destination. + throw new \Exception("No destination provided by Settings Tray form"); + } } - $response = new AjaxResponse(); return $response->addCommand($command); } diff --git a/core/modules/statistics/tests/src/Kernel/Migrate/d6/MigrateNodeCounterTest.php b/core/modules/statistics/tests/src/Kernel/Migrate/d6/MigrateNodeCounterTest.php index ea917f51a4..273b173869 100644 --- a/core/modules/statistics/tests/src/Kernel/Migrate/d6/MigrateNodeCounterTest.php +++ b/core/modules/statistics/tests/src/Kernel/Migrate/d6/MigrateNodeCounterTest.php @@ -21,6 +21,7 @@ class MigrateNodeCounterTest extends MigrateDrupal6TestBase { 'node', 'statistics', 'text', + 'migrate_drupal_i18n', ]; /** diff --git a/core/modules/statistics/tests/src/Kernel/Migrate/d7/MigrateNodeCounterTest.php b/core/modules/statistics/tests/src/Kernel/Migrate/d7/MigrateNodeCounterTest.php index 9a7317fada..e2c7cff675 100644 --- a/core/modules/statistics/tests/src/Kernel/Migrate/d7/MigrateNodeCounterTest.php +++ b/core/modules/statistics/tests/src/Kernel/Migrate/d7/MigrateNodeCounterTest.php @@ -21,6 +21,7 @@ class MigrateNodeCounterTest extends MigrateDrupal7TestBase { 'node', 'statistics', 'text', + 'migrate_drupal_i18n', ]; /** diff --git a/core/modules/taxonomy/tests/src/Kernel/Migrate/d6/MigrateTaxonomyVocabularyTranslationTest.php b/core/modules/taxonomy/tests/src/Kernel/Migrate/d6/MigrateTaxonomyVocabularyTranslationTest.php index 3993abb98f..ff6c4eaf1b 100644 --- a/core/modules/taxonomy/tests/src/Kernel/Migrate/d6/MigrateTaxonomyVocabularyTranslationTest.php +++ b/core/modules/taxonomy/tests/src/Kernel/Migrate/d6/MigrateTaxonomyVocabularyTranslationTest.php @@ -14,7 +14,7 @@ class MigrateTaxonomyVocabularyTranslationTest extends MigrateDrupal6TestBase { /** * {@inheritdoc} */ - public static $modules = ['language', 'taxonomy']; + public static $modules = ['language', 'taxonomy', 'migrate_drupal_i18n']; /** * {@inheritdoc} diff --git a/core/modules/taxonomy/tests/src/Kernel/Migrate/d6/MigrateTermNodeRevisionTest.php b/core/modules/taxonomy/tests/src/Kernel/Migrate/d6/MigrateTermNodeRevisionTest.php index 614725d966..004fce106d 100644 --- a/core/modules/taxonomy/tests/src/Kernel/Migrate/d6/MigrateTermNodeRevisionTest.php +++ b/core/modules/taxonomy/tests/src/Kernel/Migrate/d6/MigrateTermNodeRevisionTest.php @@ -14,7 +14,7 @@ class MigrateTermNodeRevisionTest extends MigrateDrupal6TestBase { /** * {@inheritdoc} */ - public static $modules = ['taxonomy', 'menu_ui']; + public static $modules = ['taxonomy', 'menu_ui', 'migrate_drupal_i18n']; /** * {@inheritdoc} diff --git a/core/modules/text/tests/src/FunctionalJavascript/TextareaWithSummaryTest.php b/core/modules/text/tests/src/FunctionalJavascript/TextareaWithSummaryTest.php deleted file mode 100644 index 76fbcc77d7..0000000000 --- a/core/modules/text/tests/src/FunctionalJavascript/TextareaWithSummaryTest.php +++ /dev/null @@ -1,85 +0,0 @@ -drupalCreateContentType(['type' => 'page']); - - $account = $this->drupalCreateUser(['create page content', 'edit own page content']); - $this->drupalLogin($account); - } - - /** - * Helper to test toggling the summary area. - */ - protected function assertSummaryToggle() { - $this->drupalGet('node/add/page'); - $widget = $this->getSession()->getPage()->findById('edit-body-wrapper'); - $summary_field = $widget->findField('edit-body-0-summary'); - - $this->assertEquals(FALSE, $summary_field->isVisible(), 'Summary field is hidden by default.'); - $this->assertEquals(FALSE, $widget->hasButton('Hide summary'), 'No Hide summary link by default.'); - - $widget->pressButton('Edit summary'); - $this->assertEquals(FALSE, $widget->hasButton('Edit summary'), 'Edit summary link is removed after clicking.'); - $this->assertEquals(TRUE, $summary_field->isVisible(), 'Summary field is shown.'); - - $widget->pressButton('Hide summary'); - $this->assertEquals(FALSE, $widget->hasButton('Hide summary'), 'Hide summary link is removed after clicking.'); - $this->assertEquals(FALSE, $summary_field->isVisible(), 'Summary field is hidden again.'); - $this->assertEquals(TRUE, $widget->hasButton('Edit summary'), 'Edit summary link is visible again.'); - } - - /** - * Tests the textSummary javascript behavior. - */ - public function testTextSummaryBehavior() { - // Test with field defaults. - $this->assertSummaryToggle(); - - // Repeat test with non-empty field description. - $body_field = FieldConfig::loadByName('node', 'page', 'body'); - $body_field->set('description', 'Text with Summary field description.'); - $body_field->save(); - - $this->assertSummaryToggle(); - - // Test summary is shown when non-empty. - $node = $this->createNode([ - 'body' => [ - [ - 'value' => $this->randomMachineName(32), - 'summary' => $this->randomMachineName(32), - 'format' => filter_default_format(), - ], - ], - ]); - - $this->drupalGet('node/' . $node->id() . '/edit'); - $page = $this->getSession()->getPage(); - $summary_field = $page->findField('edit-body-0-summary'); - - $this->assertEquals(TRUE, $summary_field->isVisible(), 'Non-empty summary field is shown by default.'); - } - -} diff --git a/core/modules/text/text.es6.js b/core/modules/text/text.es6.js index 862d4c3ec5..6c11adae1b 100644 --- a/core/modules/text/text.es6.js +++ b/core/modules/text/text.es6.js @@ -19,7 +19,7 @@ const $summary = $widget.find('.js-text-summary-wrapper'); const $summaryLabel = $summary.find('label').eq(0); - const $full = $widget.children('.js-form-type-textarea'); + const $full = $widget.find('.js-text-full').closest('.js-form-item'); let $fullLabel = $full.find('label').eq(0); // Create a placeholder label when the field cardinality is greater diff --git a/core/modules/text/text.js b/core/modules/text/text.js index 25a31e4221..c760f2dd2c 100644 --- a/core/modules/text/text.js +++ b/core/modules/text/text.js @@ -13,7 +13,7 @@ var $summary = $widget.find('.js-text-summary-wrapper'); var $summaryLabel = $summary.find('label').eq(0); - var $full = $widget.children('.js-form-type-textarea'); + var $full = $widget.find('.js-text-full').closest('.js-form-item'); var $fullLabel = $full.find('label').eq(0); if ($fullLabel.length === 0) {