Skip to content

Commit

Permalink
Merge 4.x into 5.x
Browse files Browse the repository at this point in the history
  • Loading branch information
SonataCI authored Aug 29, 2023
2 parents 22186c0 + 42fe3c0 commit 3ddf1ff
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 8 deletions.
17 changes: 10 additions & 7 deletions src/Resources/views/CRUD/display_enum.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,16 @@ file that was distributed with this source code.
#}

{%- apply spaceless %}
{% set value = use_value|default(false) ? value.value : value.name %}

{% if translation_domain|default(null) is null %}
{% set value = value %}
{% if value is null %}
 
{% else %}
{% set value = value|trans({}, translation_domain) %}
{% endif %}
{% set value = use_value|default(false) ? value.value : value.name %}

{{ value }}
{% if translation_domain|default(null) is null %}
{% set value = value %}
{% else %}
{% set value = value|trans({}, translation_domain) %}
{% endif %}
{{ value }}
{% endif %}
{% endapply -%}
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,11 @@ public function testProcessParsingFullValidConfig(): void
static::assertFalse($dashboardGroupsSettings['sonata_group_one']['on_top']);
static::assertTrue($dashboardGroupsSettings['sonata_group_three']['on_top']);
static::assertFalse($dashboardGroupsSettings['sonata_group_one']['keep_open']);
static::assertIsArray($dashboardGroupsSettings['sonata_group_one']['items'][0]);
static::assertArrayHasKey('admin', $dashboardGroupsSettings['sonata_group_one']['items'][0]);
static::assertArrayHasKey('route_params', $dashboardGroupsSettings['sonata_group_one']['items'][0]);
static::assertContains('sonata_post_admin', $dashboardGroupsSettings['sonata_group_one']['items'][0]);
static::assertIsArray($dashboardGroupsSettings['sonata_group_one']['items'][1]);
static::assertArrayHasKey('route', $dashboardGroupsSettings['sonata_group_one']['items'][1]);
static::assertArrayHasKey('label', $dashboardGroupsSettings['sonata_group_one']['items'][1]);
static::assertArrayHasKey('route_params', $dashboardGroupsSettings['sonata_group_one']['items'][1]);
Expand All @@ -100,6 +102,7 @@ public function testProcessParsingFullValidConfig(): void
static::assertSame('blog_name', $dashboardGroupsSettings['sonata_group_one']['items'][1]['route']);
static::assertSame('Blog', $dashboardGroupsSettings['sonata_group_one']['items'][1]['label']);
static::assertSame([], $dashboardGroupsSettings['sonata_group_one']['items'][1]['route_params']);
static::assertIsArray($dashboardGroupsSettings['sonata_group_one']['items'][2]);
static::assertArrayHasKey('route', $dashboardGroupsSettings['sonata_group_one']['items'][2]);
static::assertArrayHasKey('label', $dashboardGroupsSettings['sonata_group_one']['items'][2]);
static::assertArrayHasKey('route_params', $dashboardGroupsSettings['sonata_group_one']['items'][2]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,8 @@ public function testFlattenExtensionConfiguration(): void
static::assertArrayHasKey('admins', $extensionMap);
static::assertCount(1, $extensionMap['admins']);

static::assertArrayHasKey('sonata_extension_publish', $extensionMap['admins']['sonata_post_admin']);
static::assertCount(1, $extensionMap['admins']['sonata_post_admin']);
static::assertArrayHasKey('sonata_extension_publish', $extensionMap['admins']['sonata_post_admin']);

// Excludes
static::assertArrayHasKey('excludes', $extensionMap);
Expand Down
7 changes: 7 additions & 0 deletions tests/Twig/Extension/RenderElementExtensionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1513,6 +1513,13 @@ class="x-editable"
return $elements;
}

$elements[] = [
'<td class="sonata-ba-list-field sonata-ba-list-field-enum" objectId="12345"> &nbsp; </td>',
FieldDescriptionInterface::TYPE_ENUM,
null,
[],
];

$elements[] = [
'<td class="sonata-ba-list-field sonata-ba-list-field-enum" objectId="12345"> Hearts </td>',
FieldDescriptionInterface::TYPE_ENUM,
Expand Down

0 comments on commit 3ddf1ff

Please sign in to comment.