Commit 6ee3bf1e authored by Adam G-H's avatar Adam G-H
Browse files

Issue #3269892 by phenaproxima, tmaiochi, lucasbaralm, victoria-marina,...

Issue #3269892 by phenaproxima, tmaiochi, lucasbaralm, victoria-marina, apaderno, sophiavs: Make the code compatible with Drupal 10
parent 463b71b5
Loading
Loading
Loading
Loading
+1 −3
Original line number Diff line number Diff line
@@ -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)
+6 −11
Original line number Diff line number Diff line
@@ -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;
@@ -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;
  }

@@ -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')
    );
  }
+1 −1
Original line number Diff line number Diff line
@@ -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];
+1 −1
Original line number Diff line number Diff line
@@ -18,7 +18,7 @@ class LayoutBuilderEntityViewDisplayTest extends CoreTest {
  /**
   * {@inheritdoc}
   */
  public static $modules = ['layout_builder_st'];
  protected static $modules = ['layout_builder_st'];

  /**
   * {@inheritdoc}
+7 −5
Original line number Diff line number Diff line
@@ -26,7 +26,7 @@ class LayoutBuilderTranslationTest extends ContentTranslationTestBase {
  /**
   * {@inheritdoc}
   */
  public static $modules = [
  protected static $modules = [
    'content_translation',
    'contextual',
    'entity_test',
@@ -38,7 +38,7 @@ class LayoutBuilderTranslationTest extends ContentTranslationTestBase {
  /**
   * {@inheritdoc}
   */
  protected function setUp() {
  protected function setUp(): void {
    parent::setUp();
    $this->setUpViewDisplay();
    $this->setUpEntities();
@@ -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.
@@ -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