function DefaultsSectionStorage::getRouteParameters

Same name in other branches
  1. 8.9.x core/modules/layout_builder/src/Plugin/SectionStorage/DefaultsSectionStorage.php \Drupal\layout_builder\Plugin\SectionStorage\DefaultsSectionStorage::getRouteParameters()
  2. 10 core/modules/layout_builder/src/Plugin/SectionStorage/DefaultsSectionStorage.php \Drupal\layout_builder\Plugin\SectionStorage\DefaultsSectionStorage::getRouteParameters()
  3. 11.x 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
Gets the URL used to display the Layout Builder UI.
DefaultsSectionStorage::getRedirectUrl in core/modules/layout_builder/src/Plugin/SectionStorage/DefaultsSectionStorage.php
Gets the URL used when redirecting away from the Layout Builder UI.

File

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

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.