You are here

public function DashboardSectionStorage::isApplicable in Dashboards with Layout Builder 2.0.x

Same name and namespace in other branches
  1. 8 src/Plugin/SectionStorage/DashboardSectionStorage.php \Drupal\dashboards\Plugin\SectionStorage\DashboardSectionStorage::isApplicable()

Determines if this section storage is applicable for the current contexts.

@internal This method is intended to be called by \Drupal\layout_builder\SectionStorage\SectionStorageManagerInterface::findByContext().

Parameters

\Drupal\Core\Cache\RefinableCacheableDependencyInterface $cacheability: Refinable cacheability object, typically provided by the section storage manager. When implementing this method, populate $cacheability with any information that affects whether this storage is applicable.

Return value

bool TRUE if this section storage is applicable, FALSE otherwise.

Overrides SectionStorageInterface::isApplicable

See also

\Drupal\Core\Cache\RefinableCacheableDependencyInterface

1 method overrides DashboardSectionStorage::isApplicable()
UserDashboardSectionStorage::isApplicable in src/Plugin/SectionStorage/UserDashboardSectionStorage.php
Determines if this section storage is applicable for the current contexts.

File

src/Plugin/SectionStorage/DashboardSectionStorage.php, line 248

Class

DashboardSectionStorage
Dashboard section storage.

Namespace

Drupal\dashboards\Plugin\SectionStorage

Code

public function isApplicable(RefinableCacheableDependencyInterface $cacheability) {
  $entity = $this
    ->getContextValue(Dashboard::CONTEXT_TYPE);
  if (!$entity
    ->isOverriden()) {
    $cacheability
      ->addCacheableDependency($this);
    return TRUE;
  }
  return FALSE;
}