You are here

public function ProfileHeroBlock::getCacheTags in Open Social 8.7

Same name and namespace in other branches
  1. 8.9 modules/social_features/social_profile/src/Plugin/Block/ProfileHeroBlock.php \Drupal\social_profile\Plugin\Block\ProfileHeroBlock::getCacheTags()
  2. 8 modules/social_features/social_profile/src/Plugin/Block/ProfileHeroBlock.php \Drupal\social_profile\Plugin\Block\ProfileHeroBlock::getCacheTags()
  3. 8.2 modules/social_features/social_profile/src/Plugin/Block/ProfileHeroBlock.php \Drupal\social_profile\Plugin\Block\ProfileHeroBlock::getCacheTags()
  4. 8.3 modules/social_features/social_profile/src/Plugin/Block/ProfileHeroBlock.php \Drupal\social_profile\Plugin\Block\ProfileHeroBlock::getCacheTags()
  5. 8.4 modules/social_features/social_profile/src/Plugin/Block/ProfileHeroBlock.php \Drupal\social_profile\Plugin\Block\ProfileHeroBlock::getCacheTags()
  6. 8.5 modules/social_features/social_profile/src/Plugin/Block/ProfileHeroBlock.php \Drupal\social_profile\Plugin\Block\ProfileHeroBlock::getCacheTags()
  7. 8.6 modules/social_features/social_profile/src/Plugin/Block/ProfileHeroBlock.php \Drupal\social_profile\Plugin\Block\ProfileHeroBlock::getCacheTags()
  8. 8.8 modules/social_features/social_profile/src/Plugin/Block/ProfileHeroBlock.php \Drupal\social_profile\Plugin\Block\ProfileHeroBlock::getCacheTags()
  9. 10.3.x modules/social_features/social_profile/src/Plugin/Block/ProfileHeroBlock.php \Drupal\social_profile\Plugin\Block\ProfileHeroBlock::getCacheTags()
  10. 10.0.x modules/social_features/social_profile/src/Plugin/Block/ProfileHeroBlock.php \Drupal\social_profile\Plugin\Block\ProfileHeroBlock::getCacheTags()
  11. 10.1.x modules/social_features/social_profile/src/Plugin/Block/ProfileHeroBlock.php \Drupal\social_profile\Plugin\Block\ProfileHeroBlock::getCacheTags()
  12. 10.2.x modules/social_features/social_profile/src/Plugin/Block/ProfileHeroBlock.php \Drupal\social_profile\Plugin\Block\ProfileHeroBlock::getCacheTags()

The cache tags associated with this object.

When this object is modified, these cache tags will be invalidated.

Return value

string[] A set of cache tags.

Overrides ContextAwarePluginBase::getCacheTags

1 call to ProfileHeroBlock::getCacheTags()
ProfileHeroBlock::build in modules/social_features/social_profile/src/Plugin/Block/ProfileHeroBlock.php
Builds and returns the renderable array for this block plugin.

File

modules/social_features/social_profile/src/Plugin/Block/ProfileHeroBlock.php, line 84

Class

ProfileHeroBlock
Provides a 'ProfileHeroBlock' block.

Namespace

Drupal\social_profile\Plugin\Block

Code

public function getCacheTags() {
  $account = $this
    ->getContextValue('user');
  $storage = $this->entityTypeManager
    ->getStorage('profile');
  $profile = $storage
    ->loadByUser($account, 'profile');
  $tags = [
    'user:' . $account
      ->id(),
  ];
  if ($profile) {
    $tags[] = 'profile:' . $profile
      ->id();
  }
  return Cache::mergeTags(parent::getCacheTags(), $tags);
}