function OverridesSectionStorage::getSectionListFromId

Overrides SectionStorageInterface::getSectionListFromId

File

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

Class

OverridesSectionStorage
Defines the 'overrides' section storage type.

Namespace

Drupal\layout_builder\Plugin\SectionStorage

Code

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) {
        list($entity_type_id, $entity_id) = explode('.', $id, 2);
        $entity = $this->entityRepository
            ->getActive($entity_type_id, $entity_id);
        if ($entity instanceof FieldableEntityInterface && $entity->hasField(static::FIELD_NAME)) {
            return $entity->get(static::FIELD_NAME);
        }
    }
    throw new \InvalidArgumentException(sprintf('The "%s" ID for the "%s" section storage type is invalid', $id, $this->getStorageType()));
}

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