From 8e56520b6c99b09d72a78c369d6b087254471a0b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Noco=C5=84?= Date: Tue, 17 Jun 2025 10:07:02 +0200 Subject: [PATCH 1/8] Documented Twig Component attribute --- .../back_office/components/MyComponent.php | 18 ++++++++++++++++++ docs/templating/components.md | 18 +++++++++++++----- 2 files changed, 31 insertions(+), 5 deletions(-) create mode 100644 code_samples/back_office/components/MyComponent.php diff --git a/code_samples/back_office/components/MyComponent.php b/code_samples/back_office/components/MyComponent.php new file mode 100644 index 0000000000..42bbecfc78 --- /dev/null +++ b/code_samples/back_office/components/MyComponent.php @@ -0,0 +1,18 @@ + Date: Tue, 17 Jun 2025 16:06:21 +0200 Subject: [PATCH 2/8] TMP --- docs/templating/components.md | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/docs/templating/components.md b/docs/templating/components.md index 2c96d5b592..a71f2147ea 100644 --- a/docs/templating/components.md +++ b/docs/templating/components.md @@ -20,10 +20,33 @@ You can create Twig Components in one of two ways: Create a class implementing the `\Ibexa\Contracts\TwigComponents\ComponentInterface` interface and register it as a service by using the `ibexa.twig.component` service tag, for example: +=== "PHP Attribute2" + + ``` php + [[= include_file('code_samples/back_office/components/MyComponent.php') =]] + ``` + === "PHP Attribute" ``` php - [[= include_file('code_samples/back_office/components/MyComponent.php') =]] + Date: Wed, 18 Jun 2025 12:09:37 +0200 Subject: [PATCH 3/8] Update docs/templating/components.md Co-authored-by: Adrien Dupuis <61695653+adriendupuis@users.noreply.github.com> --- docs/templating/components.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/templating/components.md b/docs/templating/components.md index a71f2147ea..b01cbf9164 100644 --- a/docs/templating/components.md +++ b/docs/templating/components.md @@ -23,7 +23,7 @@ Create a class implementing the `\Ibexa\Contracts\TwigComponents\ComponentInterf === "PHP Attribute2" ``` php - [[= include_file('code_samples/back_office/components/MyComponent.php') =]] + [[= include_file('code_samples/back_office/components/MyComponent.php', 0, None, ' ') =]] ``` === "PHP Attribute" From 324dcc6c4d6567eb50a7c7341e8d1e19f94b3646 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Noco=C5=84?= Date: Mon, 23 Jun 2025 14:57:05 +0200 Subject: [PATCH 4/8] Fixes --- docs/templating/components.md | 32 +++++--------------------------- 1 file changed, 5 insertions(+), 27 deletions(-) diff --git a/docs/templating/components.md b/docs/templating/components.md index b01cbf9164..a3b78108a8 100644 --- a/docs/templating/components.md +++ b/docs/templating/components.md @@ -18,43 +18,21 @@ You can create Twig Components in one of two ways: ### PHP code -Create a class implementing the `\Ibexa\Contracts\TwigComponents\ComponentInterface` interface and register it as a service by using the `ibexa.twig.component` service tag, for example: - -=== "PHP Attribute2" - - ``` php - [[= include_file('code_samples/back_office/components/MyComponent.php', 0, None, ' ') =]] - ``` +Create a class implementing the `\Ibexa\Contracts\TwigComponents\ComponentInterface` interface. +Register it as a service by using the `AsTwigComponent` attribute or the `ibexa.twig.component` service tag: === "PHP Attribute" ``` php - Date: Thu, 3 Jul 2025 13:49:51 +0200 Subject: [PATCH 5/8] Make the examples the same --- docs/templating/components.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/templating/components.md b/docs/templating/components.md index a3b78108a8..b51b151b0f 100644 --- a/docs/templating/components.md +++ b/docs/templating/components.md @@ -32,7 +32,7 @@ Register it as a service by using the `AsTwigComponent` attribute or the `ibexa. ``` yaml App\Twig\Component\MyComponent: tags: - - { name: ibexa.twig.component, group: admin-ui-dashboard-all-tab-groups, priority: 0 } + - { name: ibexa.twig.component, group: admin-ui-dashboard-all-tab-groups, priority: 100 } ``` The available attributes are: From 675e24242ca2213ac00afcfde7d9e1e0f719681c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Noco=C5=84?= Date: Thu, 3 Jul 2025 13:53:59 +0200 Subject: [PATCH 6/8] Added highlight --- docs/templating/components.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/templating/components.md b/docs/templating/components.md index b51b151b0f..c0899d23c8 100644 --- a/docs/templating/components.md +++ b/docs/templating/components.md @@ -23,7 +23,7 @@ Register it as a service by using the `AsTwigComponent` attribute or the `ibexa. === "PHP Attribute" - ``` php + ``` php hl_lines="8-11" [[= include_file('code_samples/back_office/components/MyComponent.php', glue=' ') =]] ``` From 90cd2680d312cc88f0d5270df8b728d3fe7fc3ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Noco=C5=84?= Date: Thu, 10 Jul 2025 10:41:46 +0200 Subject: [PATCH 7/8] Update docs/templating/components.md --- docs/templating/components.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/templating/components.md b/docs/templating/components.md index c0899d23c8..a0376f5ecc 100644 --- a/docs/templating/components.md +++ b/docs/templating/components.md @@ -18,7 +18,7 @@ You can create Twig Components in one of two ways: ### PHP code -Create a class implementing the `\Ibexa\Contracts\TwigComponents\ComponentInterface` interface. +Create a class implementing the `\Ibexa\Contracts\TwigComponents\ComponentInterface` interface. Register it as a service by using the `AsTwigComponent` attribute or the `ibexa.twig.component` service tag: === "PHP Attribute" From 4ae698b7fc054bf0d9425fbc3032b9a129d2a831 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Noco=C5=84?= Date: Tue, 15 Jul 2025 16:06:20 +0200 Subject: [PATCH 8/8] Apply suggestion from @dabrt MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Tomasz DÄ…browski <64841871+dabrt@users.noreply.github.com> --- docs/templating/components.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/templating/components.md b/docs/templating/components.md index a0376f5ecc..c071a738a7 100644 --- a/docs/templating/components.md +++ b/docs/templating/components.md @@ -18,7 +18,7 @@ You can create Twig Components in one of two ways: ### PHP code -Create a class implementing the `\Ibexa\Contracts\TwigComponents\ComponentInterface` interface. +Create a class that implements the `\Ibexa\Contracts\TwigComponents\ComponentInterface` interface. Register it as a service by using the `AsTwigComponent` attribute or the `ibexa.twig.component` service tag: === "PHP Attribute"