Loading layout_builder_st.info.yml +1 −3 Original line number Diff line number Diff line Loading @@ -2,8 +2,6 @@ name: 'Layout Builder Symmetric Translations' type: module description: 'Allows translating Layout overrides' package: Layout Builder core: 8.x core_version_requirement: ^8 || ^9 core_version_requirement: ^9.1 || ^10 dependencies: - drupal:layout_builder - drupal:system (>=8.7) src/Element/LayoutBuilder.php +6 −11 Original line number Diff line number Diff line Loading @@ -5,10 +5,8 @@ namespace Drupal\layout_builder_st\Element; use Drupal\Component\Plugin\ConfigurableInterface; use Drupal\Component\Plugin\DerivativeInspectionInterface; use Drupal\Core\Entity\EntityTypeManagerInterface; use Drupal\Core\Messenger\MessengerInterface; use Drupal\Core\Render\Element; use Drupal\layout_builder\Element\LayoutBuilder as CoreLayoutbuilder; use Drupal\layout_builder\LayoutTempstoreRepositoryInterface; use Drupal\layout_builder\SectionComponent; use Drupal\layout_builder\SectionStorageInterface; use Drupal\layout_builder_st\LayoutBuilderTranslatablePluginInterface; Loading Loading @@ -38,15 +36,13 @@ final class LayoutBuilder extends CoreLayoutbuilder { * The plugin ID for the plugin instance. * @param mixed $plugin_definition * The plugin implementation definition. * @param \Drupal\layout_builder\LayoutTempstoreRepositoryInterface $layout_tempstore_repository * The layout tempstore repository. * @param \Drupal\Core\Messenger\MessengerInterface $messenger * The messenger service. * @param \Symfony\Component\EventDispatcher\EventDispatcherInterface $event_dispatcher * The event dispatcher service. * @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager * (optional) The entity type manager. * The entity type manager. */ public function __construct(array $configuration, $plugin_id, $plugin_definition, LayoutTempstoreRepositoryInterface $layout_tempstore_repository, MessengerInterface $messenger, EntityTypeManagerInterface $entity_type_manager) { parent::__construct($configuration, $plugin_id, $plugin_definition, $layout_tempstore_repository, $messenger); public function __construct(array $configuration, $plugin_id, $plugin_definition, $event_dispatcher, EntityTypeManagerInterface $entity_type_manager) { parent::__construct($configuration, $plugin_id, $plugin_definition, $event_dispatcher); $this->entityTypeManager = $entity_type_manager; } Loading @@ -58,8 +54,7 @@ final class LayoutBuilder extends CoreLayoutbuilder { $configuration, $plugin_id, $plugin_definition, $container->get('layout_builder.tempstore_repository'), $container->get('messenger'), $container->get('event_dispatcher'), $container->get('entity_type.manager') ); } Loading src/Routing/RouteSubscriber.php +1 −1 Original line number Diff line number Diff line Loading @@ -27,7 +27,7 @@ final class RouteSubscriber extends RouteSubscriberBase { /** * {@inheritdoc} */ public static function getSubscribedEvents() { public static function getSubscribedEvents(): array { // Come before \Drupal\layout_builder\Routing\LayoutBuilderRoutes. So that // only routes provide by layout_builder.routes.yml are altered. $events[RoutingEvents::ALTER] = ['onAlterRoutes', 100]; Loading tests/src/Functional/Jsonapi/LayoutBuilderEntityViewDisplayTest.php +1 −1 Original line number Diff line number Diff line Loading @@ -18,7 +18,7 @@ class LayoutBuilderEntityViewDisplayTest extends CoreTest { /** * {@inheritdoc} */ public static $modules = ['layout_builder_st']; protected static $modules = ['layout_builder_st']; /** * {@inheritdoc} Loading tests/src/Functional/LayoutBuilderTranslationTest.php +7 −5 Original line number Diff line number Diff line Loading @@ -26,7 +26,7 @@ class LayoutBuilderTranslationTest extends ContentTranslationTestBase { /** * {@inheritdoc} */ public static $modules = [ protected static $modules = [ 'content_translation', 'contextual', 'entity_test', Loading @@ -38,7 +38,7 @@ class LayoutBuilderTranslationTest extends ContentTranslationTestBase { /** * {@inheritdoc} */ protected function setUp() { protected function setUp(): void { parent::setUp(); $this->setUpViewDisplay(); $this->setUpEntities(); Loading Loading @@ -270,8 +270,9 @@ class LayoutBuilderTranslationTest extends ContentTranslationTestBase { $field_ui_prefix = 'entity_test_mul/structure/entity_test_mul'; // Allow overrides for the layout. $this->drupalPostForm("$field_ui_prefix/display/default", ['layout[enabled]' => TRUE], 'Save'); $this->drupalPostForm("$field_ui_prefix/display/default", ['layout[allow_custom]' => TRUE], 'Save'); $this->drupalGet("$field_ui_prefix/display/default"); $this->submitForm(['layout[enabled]' => TRUE], 'Save'); $this->submitForm(['layout[allow_custom]' => TRUE], 'Save'); // @todo The Layout Builder UI relies on local tasks; fix in // https://www.drupal.org/project/drupal/issues/2917777. Loading Loading @@ -299,7 +300,8 @@ class LayoutBuilderTranslationTest extends ContentTranslationTestBase { 'source' => $this->langcodes[0], 'target' => $this->langcodes[2], ]); $this->drupalPostForm($add_translation_url, [ $this->drupalGet($add_translation_url); $this->submitForm([ "{$this->fieldName}[0][value]" => 'The translated field value', ], 'Save'); } Loading Loading
layout_builder_st.info.yml +1 −3 Original line number Diff line number Diff line Loading @@ -2,8 +2,6 @@ name: 'Layout Builder Symmetric Translations' type: module description: 'Allows translating Layout overrides' package: Layout Builder core: 8.x core_version_requirement: ^8 || ^9 core_version_requirement: ^9.1 || ^10 dependencies: - drupal:layout_builder - drupal:system (>=8.7)
src/Element/LayoutBuilder.php +6 −11 Original line number Diff line number Diff line Loading @@ -5,10 +5,8 @@ namespace Drupal\layout_builder_st\Element; use Drupal\Component\Plugin\ConfigurableInterface; use Drupal\Component\Plugin\DerivativeInspectionInterface; use Drupal\Core\Entity\EntityTypeManagerInterface; use Drupal\Core\Messenger\MessengerInterface; use Drupal\Core\Render\Element; use Drupal\layout_builder\Element\LayoutBuilder as CoreLayoutbuilder; use Drupal\layout_builder\LayoutTempstoreRepositoryInterface; use Drupal\layout_builder\SectionComponent; use Drupal\layout_builder\SectionStorageInterface; use Drupal\layout_builder_st\LayoutBuilderTranslatablePluginInterface; Loading Loading @@ -38,15 +36,13 @@ final class LayoutBuilder extends CoreLayoutbuilder { * The plugin ID for the plugin instance. * @param mixed $plugin_definition * The plugin implementation definition. * @param \Drupal\layout_builder\LayoutTempstoreRepositoryInterface $layout_tempstore_repository * The layout tempstore repository. * @param \Drupal\Core\Messenger\MessengerInterface $messenger * The messenger service. * @param \Symfony\Component\EventDispatcher\EventDispatcherInterface $event_dispatcher * The event dispatcher service. * @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager * (optional) The entity type manager. * The entity type manager. */ public function __construct(array $configuration, $plugin_id, $plugin_definition, LayoutTempstoreRepositoryInterface $layout_tempstore_repository, MessengerInterface $messenger, EntityTypeManagerInterface $entity_type_manager) { parent::__construct($configuration, $plugin_id, $plugin_definition, $layout_tempstore_repository, $messenger); public function __construct(array $configuration, $plugin_id, $plugin_definition, $event_dispatcher, EntityTypeManagerInterface $entity_type_manager) { parent::__construct($configuration, $plugin_id, $plugin_definition, $event_dispatcher); $this->entityTypeManager = $entity_type_manager; } Loading @@ -58,8 +54,7 @@ final class LayoutBuilder extends CoreLayoutbuilder { $configuration, $plugin_id, $plugin_definition, $container->get('layout_builder.tempstore_repository'), $container->get('messenger'), $container->get('event_dispatcher'), $container->get('entity_type.manager') ); } Loading
src/Routing/RouteSubscriber.php +1 −1 Original line number Diff line number Diff line Loading @@ -27,7 +27,7 @@ final class RouteSubscriber extends RouteSubscriberBase { /** * {@inheritdoc} */ public static function getSubscribedEvents() { public static function getSubscribedEvents(): array { // Come before \Drupal\layout_builder\Routing\LayoutBuilderRoutes. So that // only routes provide by layout_builder.routes.yml are altered. $events[RoutingEvents::ALTER] = ['onAlterRoutes', 100]; Loading
tests/src/Functional/Jsonapi/LayoutBuilderEntityViewDisplayTest.php +1 −1 Original line number Diff line number Diff line Loading @@ -18,7 +18,7 @@ class LayoutBuilderEntityViewDisplayTest extends CoreTest { /** * {@inheritdoc} */ public static $modules = ['layout_builder_st']; protected static $modules = ['layout_builder_st']; /** * {@inheritdoc} Loading
tests/src/Functional/LayoutBuilderTranslationTest.php +7 −5 Original line number Diff line number Diff line Loading @@ -26,7 +26,7 @@ class LayoutBuilderTranslationTest extends ContentTranslationTestBase { /** * {@inheritdoc} */ public static $modules = [ protected static $modules = [ 'content_translation', 'contextual', 'entity_test', Loading @@ -38,7 +38,7 @@ class LayoutBuilderTranslationTest extends ContentTranslationTestBase { /** * {@inheritdoc} */ protected function setUp() { protected function setUp(): void { parent::setUp(); $this->setUpViewDisplay(); $this->setUpEntities(); Loading Loading @@ -270,8 +270,9 @@ class LayoutBuilderTranslationTest extends ContentTranslationTestBase { $field_ui_prefix = 'entity_test_mul/structure/entity_test_mul'; // Allow overrides for the layout. $this->drupalPostForm("$field_ui_prefix/display/default", ['layout[enabled]' => TRUE], 'Save'); $this->drupalPostForm("$field_ui_prefix/display/default", ['layout[allow_custom]' => TRUE], 'Save'); $this->drupalGet("$field_ui_prefix/display/default"); $this->submitForm(['layout[enabled]' => TRUE], 'Save'); $this->submitForm(['layout[allow_custom]' => TRUE], 'Save'); // @todo The Layout Builder UI relies on local tasks; fix in // https://www.drupal.org/project/drupal/issues/2917777. Loading Loading @@ -299,7 +300,8 @@ class LayoutBuilderTranslationTest extends ContentTranslationTestBase { 'source' => $this->langcodes[0], 'target' => $this->langcodes[2], ]); $this->drupalPostForm($add_translation_url, [ $this->drupalGet($add_translation_url); $this->submitForm([ "{$this->fieldName}[0][value]" => 'The translated field value', ], 'Save'); } Loading