diff --git a/config/sections/stats.php b/config/sections/stats.php index e18eba0acd..4c696b4d7c 100644 --- a/config/sections/stats.php +++ b/config/sections/stats.php @@ -53,6 +53,7 @@ $value = $report['value'] ?? null; $reports[] = [ + 'icon' => $toString($report['icon'] ?? null), 'info' => $toString(I18n::translate($info, $info)), 'label' => $toString(I18n::translate($label, $label)), 'link' => $toString(I18n::translate($link, $link)), diff --git a/tests/Cms/Sections/StatsSectionTest.php b/tests/Cms/Sections/StatsSectionTest.php index 1e3374f424..2901d5c352 100644 --- a/tests/Cms/Sections/StatsSectionTest.php +++ b/tests/Cms/Sections/StatsSectionTest.php @@ -15,6 +15,7 @@ public function reports() { return [ [ + 'icon' => 'heart', 'info' => 'Info A', 'label' => 'A', 'link' => 'https://getkirby.com', @@ -22,6 +23,7 @@ public function reports() 'value' => 'Value A', ], [ + 'icon' => null, 'info' => null, 'label' => 'B', 'link' => null, @@ -138,7 +140,10 @@ public function testReportsTranslatedInfo() { $section = new Section('stats', [ 'name' => 'test', - 'model' => Page::factory(['slug' => 'test']), + 'model' => Page::factory([ + 'slug' => 'test', + 'content' => ['icon' => 'heart'] + ]), 'reports' => [ [ 'label' => 'C', @@ -147,6 +152,7 @@ public function testReportsTranslatedInfo() 'en' => 'Extra information', 'de' => 'Zusatzinformation' ], + 'icon' => '{{ page.icon }}', 'link' => null, 'theme' => null, ] @@ -158,5 +164,6 @@ public function testReportsTranslatedInfo() $this->assertSame('C', $report['label']); $this->assertSame('Value C', $report['value']); $this->assertSame('Extra information', $report['info']); + $this->assertSame('heart', $report['icon']); } }