function OverridesSectionStorage::extractIdFromRoute

Overrides SectionStorageInterface::extractIdFromRoute

File

core/modules/layout_builder/src/Plugin/SectionStorage/OverridesSectionStorage.php, line 170

Class

OverridesSectionStorage
Defines the 'overrides' section storage type.

Namespace

Drupal\layout_builder\Plugin\SectionStorage

Code

public function extractIdFromRoute($value, $definition, $name, array $defaults) {
    @trigger_error('\\Drupal\\layout_builder\\SectionStorageInterface::extractIdFromRoute() is deprecated in Drupal 8.7.0 and will be removed before Drupal 9.0.0. \\Drupal\\layout_builder\\SectionStorageInterface::deriveContextsFromRoute() should be used instead. See https://www.drupal.org/node/3016262.', E_USER_DEPRECATED);
    if (strpos($value, '.') !== FALSE) {
        return $value;
    }
    if (isset($defaults['entity_type_id']) && !empty($defaults[$defaults['entity_type_id']])) {
        $entity_type_id = $defaults['entity_type_id'];
        $entity_id = $defaults[$entity_type_id];
        return $entity_type_id . '.' . $entity_id;
    }
}

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