Loading core/modules/views/src/Entity/View.php +5 −4 Changes for core/modules/views/src/Entity/View.php: 5 added lines, 4 removed lines. Original line number Diff line number Diff line Loading @@ -21,10 +21,10 @@ */ #[ConfigEntityType( id: 'view', label: new TranslatableMarkup('View', ['context' => 'View entity type']), label_collection: new TranslatableMarkup('Views', ['context' => 'View entity type']), label_singular: new TranslatableMarkup('view', ['context' => 'View entity type']), label_plural: new TranslatableMarkup('views', ['context' => 'View entity type']), label: new TranslatableMarkup('View', [], ['context' => 'View entity type']), label_collection: new TranslatableMarkup('Views', [], ['context' => 'View entity type']), label_singular: new TranslatableMarkup('view', [], ['context' => 'View entity type']), label_plural: new TranslatableMarkup('views', [], ['context' => 'View entity type']), entity_keys: [ 'id' => 'id', 'label' => 'label', Loading @@ -34,6 +34,7 @@ label_count: [ 'singular' => '@count view', 'plural' => '@count views', 'context' => 'View entity type', ], config_export: [ 'id', Loading core/modules/views/tests/src/Kernel/ViewStorageTest.php +19 −0 Changes for core/modules/views/tests/src/Kernel/ViewStorageTest.php: 19 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -340,4 +340,23 @@ public function testCreateDuplicate(): void { } } /** * Tests that the view entity type labels use the translation context. */ public function testEntityTypeLabelContext(): void { $entity_type = \Drupal::entityTypeManager()->getDefinition('view'); $labels = [ 'View' => $entity_type->getLabel(), 'Views' => $entity_type->getCollectionLabel(), 'view' => $entity_type->getSingularLabel(), 'views' => $entity_type->getPluralLabel(), ]; foreach ($labels as $string => $label) { $this->assertSame($string, $label->getUntranslatedString()); $this->assertSame('View entity type', $label->getOption('context')); $this->assertSame([], $label->getArguments()); } $this->assertSame('View entity type', $entity_type->getCountLabel(1)->getOption('context')); } } Loading
core/modules/views/src/Entity/View.php +5 −4 Changes for core/modules/views/src/Entity/View.php: 5 added lines, 4 removed lines. Original line number Diff line number Diff line Loading @@ -21,10 +21,10 @@ */ #[ConfigEntityType( id: 'view', label: new TranslatableMarkup('View', ['context' => 'View entity type']), label_collection: new TranslatableMarkup('Views', ['context' => 'View entity type']), label_singular: new TranslatableMarkup('view', ['context' => 'View entity type']), label_plural: new TranslatableMarkup('views', ['context' => 'View entity type']), label: new TranslatableMarkup('View', [], ['context' => 'View entity type']), label_collection: new TranslatableMarkup('Views', [], ['context' => 'View entity type']), label_singular: new TranslatableMarkup('view', [], ['context' => 'View entity type']), label_plural: new TranslatableMarkup('views', [], ['context' => 'View entity type']), entity_keys: [ 'id' => 'id', 'label' => 'label', Loading @@ -34,6 +34,7 @@ label_count: [ 'singular' => '@count view', 'plural' => '@count views', 'context' => 'View entity type', ], config_export: [ 'id', Loading
core/modules/views/tests/src/Kernel/ViewStorageTest.php +19 −0 Changes for core/modules/views/tests/src/Kernel/ViewStorageTest.php: 19 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -340,4 +340,23 @@ public function testCreateDuplicate(): void { } } /** * Tests that the view entity type labels use the translation context. */ public function testEntityTypeLabelContext(): void { $entity_type = \Drupal::entityTypeManager()->getDefinition('view'); $labels = [ 'View' => $entity_type->getLabel(), 'Views' => $entity_type->getCollectionLabel(), 'view' => $entity_type->getSingularLabel(), 'views' => $entity_type->getPluralLabel(), ]; foreach ($labels as $string => $label) { $this->assertSame($string, $label->getUntranslatedString()); $this->assertSame('View entity type', $label->getOption('context')); $this->assertSame([], $label->getArguments()); } $this->assertSame('View entity type', $entity_type->getCountLabel(1)->getOption('context')); } }