Problem/Motivation
/**
* Gets the runtime sections for a given entity.
*
* @param \Drupal\Core\Entity\FieldableEntityInterface $entity
* The entity.
*
* @return \Drupal\layout_builder\Section[]
* The sections.
*/
protected function getRuntimeSections(FieldableEntityInterface $entity) {
if ($this->isOverridable() && !$entity->get('layout_builder__layout')->isEmpty()) {
return $entity->get('layout_builder__layout')->getSections();
}
return $this->getSections();
}
The term "runtime" is not helpful here, as it seems to be referring to a special concept that doesn't exist.
Proposed resolution
- Improve the docblock
- Consider renaming to getEntitySections()
- Consider deprecating in favor of
\Drupal\layout_builder\LayoutEntityHelperTrait::getEntitySections()
Remaining tasks
Decide the scope
User interface changes
N/A
API changes
Only protected methods changing
Data model changes
N/A
Comments
Comment #3
xjm@phenaproxima and I originally raised this question.
Comment #4
xjmComment #5
tim.plunkett#2976148: Layout-based entity rendering should delegate to the correct section storage instead of hardcoding to either defaults or overrides deprecated that method