From 42e2dec7ca9386f2fc82c07529efa3d6153bedcd Mon Sep 17 00:00:00 2001 From: Reinhard Hutter Date: Thu, 15 Sep 2022 11:28:12 +0200 Subject: [PATCH] [generate:entity:content] per-bundle-permissions (#4216) [generate:entity:content] wrongly creates one permission per entity (database row), instead of one permission per entity type. --- .../module/src/entity-content-bundle-permissions.php.twig | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/templates/module/src/entity-content-bundle-permissions.php.twig b/templates/module/src/entity-content-bundle-permissions.php.twig index 5c00b2250..22865dd50 100644 --- a/templates/module/src/entity-content-bundle-permissions.php.twig +++ b/templates/module/src/entity-content-bundle-permissions.php.twig @@ -11,7 +11,7 @@ namespace Drupal\{{ module }}; {% block use_class %} use Drupal\Core\StringTranslation\StringTranslationTrait; -use Drupal\{{ module }}\Entity\{{ entity_class }}; +use Drupal\{{ module }}\Entity\{{ entity_class }}Type; {% endblock %} @@ -37,7 +37,7 @@ class {{ entity_class }}Permissions{% endblock %} public function generatePermissions() { $perms = []; - foreach ({{ entity_class }}::loadMultiple() as $type) { + foreach ({{ entity_class }}Type::loadMultiple() as $type) { $perms += $this->buildPermissions($type); } @@ -47,13 +47,13 @@ class {{ entity_class }}Permissions{% endblock %} /** * Returns a list of node permissions for a given node type. * - * @param \Drupal\{{ module }}\Entity\{{ entity_class }} $type + * @param \Drupal\{{ module }}\Entity\{{ entity_class }}Type $type * The {{ entity_class }} type. * * @return array * An associative array of permission names and descriptions. */ - protected function buildPermissions({{ entity_class}} $type) { + protected function buildPermissions({{ entity_class}}Type $type) { $type_id = $type->id(); $type_params = ['%type_name' => $type->label()];