Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
/**
* Wraps all the available web segment.
*
* @param string $operation
* The entity operation to use this for. Defaults to 'view'.
*
* @return \Drupal\foo\WrappedEntities\WebSegment[]
* The web segments.
*
* @throws \Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException
* @throws \Drupal\Component\Plugin\Exception\PluginNotFoundException
* @throws \Drupal\typed_entity\InvalidValueException
*/
public function wrapAll($operation = 'view'): array {
$bundle_key = $this->entityType->getKey('bundle');
$terms = $this->entityTypeManager
->getStorage($this->entityType->id())
->loadByProperties([$bundle_key => $this->bundle]);
$check_access = static function (TermInterface $term) use ($operation) {
return $term->access($operation);
};
$accessible_terms = array_filter($terms, $check_access);
return $this->wrapMultiple($accessible_terms);
}
Comment | File | Size | Author |
---|---|---|---|
#5 | 3164332--wrap-all--4.patch | 1.76 KB | e0ipso |
#4 | 3164332--wrap-all--3.patch | 1.75 KB | e0ipso |
#3 | 3164332--wrap-all--2.patch | 1.75 KB | e0ipso |
Comments
Comment #2
e0ipsoComment #3
e0ipsoComment #4
e0ipsoComment #5
e0ipsoComment #6
e0ipso