public function VocabularyListBuilder::load in Taxonomy access fix 8.3
Same name and namespace in other branches
- 8 src/VocabularyListBuilder.php \Drupal\taxonomy_access_fix\VocabularyListBuilder::load()
- 8.2 src/VocabularyListBuilder.php \Drupal\taxonomy_access_fix\VocabularyListBuilder::load()
Loads entities of this type from storage for listing.
This allows the implementation to manipulate the listing, like filtering or sorting the loaded entities.
Return value
\Drupal\Core\Entity\EntityInterface[] An array of entities implementing \Drupal\Core\Entity\EntityInterface indexed by their IDs. Returns an empty array if no matching entities are found.
Overrides ConfigEntityListBuilder::load
File
- src/
VocabularyListBuilder.php, line 15
Class
- VocabularyListBuilder
- Builds administrative lists of Taxonomy Vocabulary entities.
Namespace
Drupal\taxonomy_access_fixCode
public function load() {
$entities = parent::load();
// Remove vocabularies the current user doesn't have any access for.
foreach ($entities as $id => $entity) {
if (!$entity
->access('view')) {
unset($entities[$id]);
}
}
return $entities;
}