entityManager = $entity_manager; } /** * {@inheritdoc} */ public static function create(ContainerInterface $container) { return new static($container->get('entity.manager')); } /** * Get taxonomy permissions. * * @return array * Permissions array. */ public function permissions() { $permissions = []; foreach ($this->entityManager->getStorage('taxonomy_vocabulary')->loadMultiple() as $vocabulary) { $permissions += [ 'edit terms in ' . $vocabulary->id() => [ 'title' => $this->t('Edit terms in %vocabulary', ['%vocabulary' => $vocabulary->label()]), ], ]; $permissions += [ 'delete terms in ' . $vocabulary->id() => [ 'title' => $this->t('Delete terms from %vocabulary', ['%vocabulary' => $vocabulary->label()]), ], ]; } return $permissions; } }