function DefaultsSectionStorage::getSectionListFromId
Overrides SectionStorageInterface::getSectionListFromId
File
-
core/
modules/ layout_builder/ src/ Plugin/ SectionStorage/ DefaultsSectionStorage.php, line 239
Class
- DefaultsSectionStorage
- Defines the 'defaults' section storage type.
Namespace
Drupal\layout_builder\Plugin\SectionStorageCode
public function getSectionListFromId($id) {
@trigger_error('\\Drupal\\layout_builder\\SectionStorageInterface::getSectionListFromId() is deprecated in Drupal 8.7.0 and will be removed before Drupal 9.0.0. The section list should be derived from context. See https://www.drupal.org/node/3016262.', E_USER_DEPRECATED);
if (strpos($id, '.') === FALSE) {
throw new \InvalidArgumentException(sprintf('The "%s" ID for the "%s" section storage type is invalid', $id, $this->getStorageType()));
}
$storage = $this->entityTypeManager
->getStorage('entity_view_display');
// If the display does not exist, create a new one.
if (!($display = $storage->load($id))) {
list($entity_type_id, $bundle, $view_mode) = explode('.', $id, 3);
$display = $storage->create([
'targetEntityType' => $entity_type_id,
'bundle' => $bundle,
'mode' => $view_mode,
'status' => TRUE,
]);
}
return $display;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.