Verified Commit 088cfe36 authored by Alex Pott's avatar Alex Pott
Browse files

Issue #2935999 by tim.plunkett, larowlan, johnwebdev, ptmkenny: Remove Layout...

Issue #2935999 by tim.plunkett, larowlan, johnwebdev, ptmkenny: Remove Layout Builder's hard dependency on Field UI

(cherry picked from commit a849aca4)
parent 18db8725
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -6,7 +6,5 @@ version: VERSION
dependencies:
  - drupal:layout_discovery
  - drupal:contextual
  # @todo Discuss removing in https://www.drupal.org/project/drupal/issues/2935999.
  - drupal:field_ui
  # @todo Discuss removing in https://www.drupal.org/project/drupal/issues/3003610.
  - drupal:block
+9 −4
Original line number Diff line number Diff line
@@ -14,7 +14,6 @@
use Drupal\Core\Plugin\Context\EntityContext;
use Drupal\Core\Session\AccountInterface;
use Drupal\Core\Url;
use Drupal\field_ui\FieldUI;
use Drupal\layout_builder\DefaultsSectionStorageInterface;
use Drupal\layout_builder\Entity\SampleEntityGeneratorInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
@@ -136,15 +135,21 @@ public function getLayoutBuilderUrl($rel = 'view') {
  protected function getRouteParameters() {
    $display = $this->getDisplay();
    $entity_type = $this->entityTypeManager->getDefinition($display->getTargetEntityTypeId());
    $route_parameters = FieldUI::getRouteBundleParameter($entity_type, $display->getTargetBundle());
    $route_parameters['view_mode_name'] = $display->getMode();
    return $route_parameters;
    $bundle_parameter_key = $entity_type->getBundleEntityType() ?: 'bundle';
    return [
      $bundle_parameter_key => $display->getTargetBundle(),
      'view_mode_name' => $display->getMode(),
    ];
  }

  /**
   * {@inheritdoc}
   */
  public function buildRoutes(RouteCollection $collection) {
    if (!\Drupal::moduleHandler()->moduleExists('field_ui')) {
      return;
    }

    foreach ($this->getEntityTypes() as $entity_type_id => $entity_type) {
      // Try to get the route from the current collection.
      if (!$entity_route = $collection->get($entity_type->get('field_ui_base_route'))) {
+1 −0
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ class LayoutBuilderAccessTest extends BrowserTestBase {
  protected static $modules = [
    'layout_builder',
    'block_test',
    'field_ui',
    'node',
    'user',
  ];
+1 −0
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@ class LayoutBuilderPrepareLayoutTest extends BrowserTestBase {
   * {@inheritdoc}
   */
  protected static $modules = [
    'field_ui',
    'layout_builder',
    'node',
    'layout_builder_element_test',
+1 −0
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@ class LayoutBuilderSectionStorageTest extends BrowserTestBase {
   */
  protected static $modules = [
    'layout_builder',
    'field_ui',
    'node',
    'layout_builder_test',
  ];
Loading