diff --git a/core/modules/layout_builder/src/SectionStorage/SectionStorageManagerInterface.php b/core/modules/layout_builder/src/SectionStorage/SectionStorageManagerInterface.php index 7403008634..1c9dd409ec 100644 --- a/core/modules/layout_builder/src/SectionStorage/SectionStorageManagerInterface.php +++ b/core/modules/layout_builder/src/SectionStorage/SectionStorageManagerInterface.php @@ -31,14 +31,22 @@ public function load($type, array $contexts = []); /** * Finds the section storage to load based on available contexts. * + * After calling this method the $cacheability parameter will reflect the + * cacheability metadata used to determine the correct section storage. This + * must be applied to any output that results from the calling of this method. + * * @param \Drupal\Component\Plugin\Context\ContextInterface[] $contexts * The contexts which should be used to determine which storage to return. * @param \Drupal\Core\Cache\CacheableMetadata $cacheability * Cacheability metadata object, which will be populated based on the - * cacheability of each section storage candidate. + * cacheability of each section storage candidate. This is typically created + * directly before this method call and must be applied to a render array + * after this method call. * * @return \Drupal\layout_builder\SectionStorageInterface|null * The section storage if one matched all contexts, or NULL otherwise. + * + * @see \Drupal\Core\Cache\CacheableMetadata */ public function findByContext(array $contexts, CacheableMetadata $cacheability); diff --git a/core/modules/layout_builder/src/SectionStorageInterface.php b/core/modules/layout_builder/src/SectionStorageInterface.php index d044f34b3f..43345035b1 100644 --- a/core/modules/layout_builder/src/SectionStorageInterface.php +++ b/core/modules/layout_builder/src/SectionStorageInterface.php @@ -169,11 +169,18 @@ public function save(); * Returns if the section storage should be selected during plugin mapping. * * @param \Drupal\Core\Cache\CacheableMetadata $cacheability - * Cacheability metadata object, which must be populated with any - * information used in this method. + * Cacheability metadata object, typically provided by the section storage + * manager. When implementing this method, populate $cacheability with any + * information that affects whether the storage is applicable. * * @return bool * TRUE if the section storage can be used, FALSE otherwise. + * + * @internal + * This method is intended to be called by + * \Drupal\layout_builder\SectionStorage\SectionStorageManagerInterface::findByContext(). + * + * @see \Drupal\Core\Cache\CacheableMetadata */ public function isApplicable(CacheableMetadata $cacheability);