function DefaultsSectionStorage::getRouteParameters

Same name in other branches
  1. 9 core/modules/layout_builder/src/Plugin/SectionStorage/DefaultsSectionStorage.php \Drupal\layout_builder\Plugin\SectionStorage\DefaultsSectionStorage::getRouteParameters()
  2. 8.9.x core/modules/layout_builder/src/Plugin/SectionStorage/DefaultsSectionStorage.php \Drupal\layout_builder\Plugin\SectionStorage\DefaultsSectionStorage::getRouteParameters()
  3. 10 core/modules/layout_builder/src/Plugin/SectionStorage/DefaultsSectionStorage.php \Drupal\layout_builder\Plugin\SectionStorage\DefaultsSectionStorage::getRouteParameters()

Provides the route parameters needed to generate a URL for this object.

Return value

mixed[] An associative array of parameter names and values.

2 calls to DefaultsSectionStorage::getRouteParameters()
DefaultsSectionStorage::getLayoutBuilderUrl in core/modules/layout_builder/src/Plugin/SectionStorage/DefaultsSectionStorage.php
DefaultsSectionStorage::getRedirectUrl in core/modules/layout_builder/src/Plugin/SectionStorage/DefaultsSectionStorage.php

File

core/modules/layout_builder/src/Plugin/SectionStorage/DefaultsSectionStorage.php, line 141

Class

DefaultsSectionStorage
Defines the 'defaults' section storage type.

Namespace

Drupal\layout_builder\Plugin\SectionStorage

Code

protected function getRouteParameters() {
    $display = $this->getDisplay();
    $entity_type = $this->entityTypeManager
        ->getDefinition($display->getTargetEntityTypeId());
    $bundle_parameter_key = $entity_type->getBundleEntityType() ?: 'bundle';
    return [
        $bundle_parameter_key => $display->getTargetBundle(),
        'view_mode_name' => $display->getMode(),
    ];
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.