function DefaultsSectionStorage::extractIdFromRoute
Overrides SectionStorageInterface::extractIdFromRoute
File
-
core/
modules/ layout_builder/ src/ Plugin/ SectionStorage/ DefaultsSectionStorage.php, line 219
Class
- DefaultsSectionStorage
- Defines the 'defaults' section storage type.
Namespace
Drupal\layout_builder\Plugin\SectionStorageCode
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 (is_string($value) && strpos($value, '.') !== FALSE) {
return $value;
}
// If a bundle is not provided but a value corresponding to the bundle key
// is, use that for the bundle value.
if (empty($defaults['bundle']) && isset($defaults['bundle_key']) && !empty($defaults[$defaults['bundle_key']])) {
$defaults['bundle'] = $defaults[$defaults['bundle_key']];
}
if (!empty($defaults['entity_type_id']) && !empty($defaults['bundle']) && !empty($defaults['view_mode_name'])) {
return $defaults['entity_type_id'] . '.' . $defaults['bundle'] . '.' . $defaults['view_mode_name'];
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.