getSingularLabel(); $entity_type_id = $entity_type->id(); $bundles = $this->entityTypeBundleInfo->getBundleInfo($entity_type_id); foreach ($bundles as $bundle_name => $bundle_info) { $permissions["view any {$bundle_name} {$entity_type_id}"] = [ 'title' => $this->t('@bundle: View any @type', [ '@bundle' => $bundle_info['label'], '@type' => $singular_label, ]), ]; $permissions["view own {$bundle_name} {$entity_type_id}"] = [ 'title' => $this->t('@bundle: View own @type', [ '@bundle' => $bundle_info['label'], '@type' => $singular_label, ]), ]; } return $permissions; } }