|
2 | 2 | description: Back office components allow you to inject any custom widgets into selected places of the user interface. |
3 | 3 | --- |
4 | 4 |
|
5 | | -# Custom components |
6 | | - |
7 | | -The back office has designated places where you can use your own components. |
8 | | - |
9 | | -Components enable you to inject widgets (for example, **My dashboard** blocks) and HTML code (for example, a tag for loading JS or CSS files). |
10 | | -A component is any class that implements the `Renderable` interface. |
11 | | -It must be tagged as a service in `config/services.yaml`: |
12 | | - |
13 | | -``` yaml |
14 | | -App\Component\MyNewComponent: |
15 | | - tags: |
16 | | - - { name: ibexa.admin_ui.component, group: content-edit-form-before } |
17 | | -``` |
18 | | -
|
19 | | -`group` indicates where the widget is displayed. The available groups are: |
20 | | - |
21 | | -- [`stylesheet-head`](https://github.com/ibexa/admin-ui/blob/main/src/bundle/Resources/views/themes/admin/ui/layout.html.twig#L101) |
22 | | -- [`script-head`](https://github.com/ibexa/admin-ui/blob/main/src/bundle/Resources/views/themes/admin/ui/layout.html.twig#L102) |
23 | | -- [`stylesheet-body`](https://github.com/ibexa/admin-ui/blob/main/src/bundle/Resources/views/themes/admin/ui/layout.html.twig#L210) |
24 | | -- [`script-body`](https://github.com/ibexa/admin-ui/blob/main/src/bundle/Resources/views/themes/admin/ui/layout.html.twig#L211) |
25 | | -- [`content-edit-form-before`](https://github.com/ibexa/admin-ui/blob/main/src/bundle/Resources/views/themes/admin/user/edit.html.twig#L37) |
26 | | -- [`content-edit-form-after`](https://github.com/ibexa/admin-ui/blob/main/src/bundle/Resources/views/themes/admin/user/edit.html.twig#L47) |
27 | | -- [`content-create-form-before`](https://github.com/ibexa/admin-ui/blob/main/src/bundle/Resources/views/themes/admin/user/create.html.twig#L37) |
28 | | -- [`content-create-form-after`](https://github.com/ibexa/admin-ui/blob/main/src/bundle/Resources/views/themes/admin/user/create.html.twig#L45) |
29 | | -- [`dashboard-blocks`](https://github.com/ibexa/admin-ui/blob/main/src/bundle/Resources/views/themes/admin/ui/dashboard/dashboard.html.twig#L30) |
30 | | -- [`dashboard-all-tab-groups`](https://github.com/ibexa/admin-ui/blob/main/src/bundle/Resources/views/themes/admin/ui/dashboard/block/all.html.twig#L6) |
31 | | -- [`dashboard-my-tab-groups`](https://github.com/ibexa/admin-ui/blob/main/src/bundle/Resources/views/themes/admin/ui/dashboard/block/me.html.twig#L6) |
32 | | -- [`content-type-tab-groups`](https://github.com/ibexa/admin-ui/blob/main/src/bundle/Resources/views/themes/admin/content_type/index.html.twig#L37) |
33 | | -- `calendar-widget-before` |
34 | | -- [`login-form-before`](https://github.com/ibexa/admin-ui/blob/main/src/bundle/Resources/views/themes/admin/account/login/index.html.twig#L7) |
35 | | -- [`login-form-after`](https://github.com/ibexa/admin-ui/blob/main/src/bundle/Resources/views/themes/admin/account/login/index.html.twig#L70) |
36 | | -- [`global-search`](https://github.com/ibexa/admin-ui/blob/main/src/bundle/Resources/views/themes/admin/ui/layout.html.twig#L129) |
37 | | - |
38 | | -## Base component classes |
39 | | - |
40 | | -If you only need to inject a short element (for example, a Twig template or a CSS link) without writing a class, you can make use of the following base classes: |
41 | | - |
42 | | -- `TwigComponent` renders a Twig template. |
43 | | -- `LinkComponent` renders the HTML `<link>` tag. |
44 | | -- `ScriptComponent` renders the HTML `<script>` tag. |
45 | | - |
46 | | -In this case, all you have to do is add a service definition (with proper parameters), for example: |
47 | | - |
48 | | -``` yaml |
49 | | -appbundle.components.my_twig_component: |
50 | | - parent: Ibexa\AdminUi\Component\TwigComponent |
51 | | - autowire: true |
52 | | - autoconfigure: false |
53 | | - arguments: |
54 | | - $template: path/to/file.html.twig |
55 | | - $parameters: |
56 | | - first_param: first_value |
57 | | - second_param: second_value |
58 | | - tags: |
59 | | - - { name: ibexa.admin_ui.component, group: dashboard-blocks } |
60 | | -``` |
61 | | - |
62 | | -This renders the `path/to/file.html.twig` template with `first_param` and `second_param` as parameters. |
63 | | - |
64 | | -With `LinkComponent` and `ScriptComponent` you provide `$href` and `$src` as arguments: |
65 | | - |
66 | | -``` yaml |
67 | | -app.components.my_link_component: |
68 | | - parent: Ibexa\AdminUi\Component\LinkComponent |
69 | | - autowire: true |
70 | | - autoconfigure: false |
71 | | - arguments: |
72 | | - $href: 'http://address.of/file.css' |
73 | | - tags: |
74 | | - - { name: ibexa.admin_ui.component, group: stylesheet-head } |
75 | | -``` |
76 | | - |
77 | | -``` yaml |
78 | | -app.components.my_script_component: |
79 | | - parent: Ibexa\AdminUi\Component\ScriptComponent |
80 | | - autowire: true |
81 | | - autoconfigure: false |
82 | | - arguments: |
83 | | - $src: 'http://address.of/file.js' |
84 | | - tags: |
85 | | - - { name: ibexa.admin_ui.component, group: script-body } |
86 | | -``` |
| 5 | +# Customizing the back office with Twig Components |
| 6 | + |
| 7 | +You can customize many of the back office views by using [Twig components](components.md). |
| 8 | +This allows you to inject your own custom logic and extend the templates. |
| 9 | + |
| 10 | +The available groups for the back office are: |
| 11 | + |
| 12 | +## Admin UI |
| 13 | + |
| 14 | +| Group name | Template file | |
| 15 | +|---|---| |
| 16 | +|`admin-ui-login-form-after` | `vendor/ibexa/admin-ui/src/bundle/Resources/views/themes/admin/account/login/index.html.twig` | |
| 17 | +|`admin-ui-login-form-before` | `vendor/ibexa/admin-ui/src/bundle/Resources/views/themes/admin/account/login/index.html.twig` | |
| 18 | +|`admin-ui-content-create-form-before`| <ul><li>`vendor/ibexa/admin-ui-ui/src/bundle/Resources/views/themes/admin/content/create/create.html.twig`</li><li> `vendor/ibexa/admin-ui-ui/src/bundle/Resources/views/themes/admin/ui/on_the_fly/create_on_the_fly.html.twig`</li><li>`vendor/ibexa/admin-ui-ui/src/bundle/Resources/views/themes/admin/user/create.html.twig` </li></ul>| |
| 19 | +|`admin-ui-content-create-form-after`| <ul><li>`vendor/ibexa/admin-ui-ui/src/bundle/Resources/views/themes/admin/content/create/create.html.twig`</li><li>`vendor/ibexa/admin-ui-ui/src/bundle/Resources/views/themes/admin/ui/on_the_fly/create_on_the_fly.html.twig`</li><li> `vendor/ibexa/admin-ui-ui/src/bundle/Resources/views/themes/admin/user/create.html.twig`</li></ul> | |
| 20 | +|`admin-ui-content-edit-form-after`| <ul><li> `vendor/ibexa/admin-ui-ui/src/bundle/Resources/views/themes/admin/content/edit/edit.html.twig` </li><li> `vendor/ibexa/admin-ui-ui/src/bundle/Resources/views/themes/admin/ui/on_the_fly/edit_on_the_fly.html.twig`</li><li> `vendor/ibexa/admin-ui-ui/src/bundle/Resources/views/themes/admin/user/edit.html.twig`</li></ul> | |
| 21 | +|`admin-ui-content-edit-form-before`| <ul><li>`vendor/ibexa/admin-ui-ui/src/bundle/Resources/views/themes/admin/content/edit/edit.html.twig`</li><li>`vendor/ibexa/admin-ui-ui/src/bundle/Resources/views/themes/admin/ui/on_the_fly/edit_on_the_fly.html.twig`</li><li> `vendor/ibexa/admin-ui-ui/src/bundle/Resources/views/themes/admin/user/edit.html.twig`</li></ul> | |
| 22 | +|`admin-ui-content-edit-sections`| <ul><li>`vendor/ibexa/admin-ui-ui/src/bundle/Resources/views/themes/admin/content/edit/edit.html.twig`</li><li>`vendor/ibexa/admin-ui-ui/src/bundle/Resources/views/themes/admin/ui/on_the_fly/create_on_the_fly.html.twig`</li><li>`vendor/ibexa/admin-ui-ui/src/bundle/Resources/views/themes/admin/ui/on_the_fly/edit_on_the_fly.html.twig`</li></ul> | |
| 23 | +|`admin-ui-content-form-create-header-actions`| `vendor/ibexa/admin-ui-ui/src/bundle/Resources/views/themes/admin/content/create/create.html.twig` | |
| 24 | +|`admin-ui-content-form-edit-header-actions`| `vendor/ibexa/admin-ui-ui/src/bundle/Resources/views/themes/admin/content/edit/edit.html.twig` | |
| 25 | +|`admin-ui-content-tree-after`| `vendor/ibexa/admin-ui/src/bundle/Resources/views/themes/admin/content/location_view.html.twig` | |
| 26 | +|`admin-ui-content-tree-before`| `vendor/ibexaadmin-ui/src/bundle/Resources/views/themes/admin/content/location_view.html.twig` | |
| 27 | +|`admin-ui-content-type-edit-sections`| `vendor/ibexa/admin-ui-ui/src/bundle/Resources/views/themes/admin/content_type/edit.html.twig` | |
| 28 | +|`admin-ui-content-type-tab-groups`| `vendor/ibexa/admin-ui-ui/src/bundle/Resources/views/themes/admin/content_type/index.html.twig` | |
| 29 | +|`admin-ui-dashboard-all-tab-groups`| `vendor/ibexa/admin-ui-ui/src/bundle/Resources/views/themes/admin/ui/dashboard/block/all.html.twig` | |
| 30 | +|`admin-ui-dashboard-blocks`| `vendor/ibexa/admin-ui-ui/src/bundle/Resources/views/themes/admin/ui/dashboard/dashboard.html.twig` | |
| 31 | +|`admin-ui-dashboard-my-tab-groups`| `vendor/ibexa/admin-ui-ui/src/bundle/Resources/views/themes/admin/ui/dashboard/block/me.html.twig` | |
| 32 | +|`admin-ui-distraction-free-mode-extras`| `vendor/ibexa/admin-ui-ui/src/bundle/Resources/views/themes/admin/ui/form_fields.html.twig` | |
| 33 | +|`admin-ui-form-content-add-translation-body`| `vendor/ibexa/admin-ui-ui/src/bundle/Resources/views/themes/admin/content/modal/add_translation.html.twig` | |
| 34 | +|`admin-ui-global-search-autocomplete-templates`| `vendor/ibexa/admin-ui-ui/src/bundle/Resources/views/themes/admin/ui/global_search.html.twig` | |
| 35 | +|`admin-ui-global-search`| `vendor/ibexa/admin-ui-ui/src/bundle/Resources/views/themes/admin/ui/layout.html.twig` | |
| 36 | +|`admin-ui-header-user-menu-middle`| `vendor/ibexa/admin-ui-ui/src/bundle/Resources/views/themes/admin/ui/menu/user.html.twig` | |
| 37 | +|`admin-ui-image-edit-actions-after`| <ul><li>`vendor/ibexa/admin-ui-ui/src/bundle/Resources/views/themes/admin/ui/field_type/edit/ezimage.html.twig` </li><li>`vendor/ibexa/admin-ui-ui/src/bundle/Resources/views/themes/admin/ui/field_type/edit/ezimageasset.html.twig` </li></ul>| |
| 38 | +|`admin-ui-layout-content-after`| `vendor/ibexa/admin-ui-ui/src/bundle/Resources/views/themes/admin/ui/layout.html.twig` | |
| 39 | +|`admin-ui-link-manager-block`| `vendor/ibexa/admin-ui-ui/src/bundle/Resources/views/themes/admin/url_management/url_management.html.twig` | |
| 40 | +|`admin-ui-location-view-content-alerts`| `vendor/ibexa/admin-ui/src/bundle/Resources/views/themes/admin/content/location_view.html.twig` | |
| 41 | +|`admin-ui-location-view-tab-groups`| `vendor/ibexa/admin-ui/src/bundle/Resources/views/themes/admin/content/location_view.html.twig` | |
| 42 | +|`admin-ui-location-view-tabs-after`| `vendor/ibexa/admin-ui-ui/src/bundle/Resources/views/themes/admin/ui/tab/location_view.html.twig` | |
| 43 | +|`admin-ui-script-body`| `vendor/ibexa/admin-ui-ui/src/bundle/Resources/views/themes/admin/ui/layout.html.twig` | |
| 44 | +|`admin-ui-script-head`| `vendor/ibexa/admin-ui-ui/src/bundle/Resources/views/themes/admin/ui/layout.html.twig` | |
| 45 | +|`admin-ui-stylesheet-body`| <ul><li>`vendor/ibexa/admin-ui-ui/src/bundle/Resources/views/themes/admin/ui/layout_error.html.twig`</li><li>`vendor/ibexa/admin-ui-ui/src/bundle/Resources/views/themes/admin/ui/layout.html.twig`</li> | |
| 46 | +|`admin-ui-stylesheet-head`| `vendor/ibexa/admin-ui-ui/src/bundle/Resources/views/themes/admin/ui/layout.html.twig` | |
| 47 | +|`admin-ui-systeminfo-tab-groups`| `vendor/ibexa/system-info/src/bundle/Resources/views/themes/admin/system_info/info.html.twig` | |
| 48 | +|`admin-ui-user-menu`| `vendor/ibexa/admin-ui-ui/src/bundle/Resources/views/themes/admin/ui/layout.html.twig` | |
| 49 | +|`admin-ui-user-profile-blocks`| `vendor/ibexa/admin-ui/src/bundle/Resources/views/themes/admin/account/profile/view.html.twig` | |
| 50 | + |
| 51 | +For more information, see [this example using few of those components](components.md#example). |
| 52 | + |
| 53 | +## Calendar |
| 54 | + |
| 55 | +| Group name | Template file | |
| 56 | +|---|---| |
| 57 | +|`admin-ui-calendar-widget-before`| `vendor/ibexa/calendar/src/bundle/Resources/views/themes/admin/calendar/view.html.twig` | |
| 58 | + |
| 59 | +## Site Context |
| 60 | + |
| 61 | +| Group name | Template file | |
| 62 | +|---|---| |
| 63 | +|`admin-ui-content-tree-before`| `vendor/ibexa/site-context/src/bundle/Resources/views/themes/admin/content/fullscreen.html.twig` | |
| 64 | +|`admin-ui-content-tree-after`| `vendor/ibexa/site-context/src/bundle/Resources/views/themes/admin/content/fullscreen.html.twig` | |
| 65 | + |
| 66 | +## Product Catalog |
| 67 | + |
| 68 | +| Group name | Template file | |
| 69 | +|---|---| |
| 70 | +|`admin-ui-attribute-definition-block`| `vendor/ibexa/product-catalog/src/bundle/Resources/views/themes/admin/product_catalog/attribute_definition/view.html.twig` | |
| 71 | +|`admin-ui-attribute-definition-options-block`| `pvendor/ibexa/roduct-catalog/src/bundle/Resources/views/themes/admin/product_catalog/attribute_definition/tab/details.html.twig` | |
| 72 | +|`admin-ui-attribute-group-block`| `vendor/ibexa/product-catalog/src/bundle/Resources/views/themes/admin/product_catalog/attribute_group/view.html.twig` | |
| 73 | +|`admin-ui-catalog-block`| `vendor/ibexa/product-catalog/src/bundle/Resources/views/themes/admin/product_catalog/catalog/view.html.twig` | |
| 74 | +|`admin-ui-customer-group-block`| `vendor/ibexa/product-catalog/src/bundle/Resources/views/themes/admin/product_catalog/customer_group/view.html.twig` | |
| 75 | +|`admin-ui-product-create-form-header-actions`| `vendor/ibexa/product-catalog/src/bundle/Resources/views/themes/admin/product_catalog/product/create.html.twig` | |
| 76 | +|`admin-ui-product-create-form-after`| `vendor/ibexa/product-catalog/src/bundle/Resources/views/themes/admin/product_catalog/product/create.html.twig` | |
| 77 | +|`admin-ui-product-edit-form-header-actions`| `vendor/ibexa/product-catalog/src/bundle/Resources/views/themes/admin/product_catalog/product/edit.html.twig` | |
| 78 | +|`admin-ui-product-edit-form-after`| `vendor/ibexa/product-catalog/src/bundle/Resources/views/themes/admin/product_catalog/product/edit.html.twig` | |
| 79 | +|`admin-ui-product-block`| `vendor/ibexa/product-catalog/src/bundle/Resources/views/themes/admin/product_catalog/product/view.html.twig` | |
| 80 | +|`admin-ui-product-type-block`| `vendor/ibexa/product-catalog/src/bundle/Resources/views/themes/admin/product_catalog/product_type/view.html.twig` | |
| 81 | + |
| 82 | +## Taxonomy |
| 83 | + |
| 84 | +| Group name | Template file | |
| 85 | +|---|---| |
| 86 | +|`admin-ui-location-view-tab-groups`| `vendor/ibexa/taxonomy/src/bundle/Resources/views/themes/admin/ibexa/taxonomy/taxonomy_entry/show.html.twig` | |
| 87 | + |
| 88 | +## Page Builder [[% include 'snippets/experience_badge.md' %]] |
| 89 | + |
| 90 | +| Group name | Template file | |
| 91 | +|---|---| |
| 92 | +|`admin-ui-infobar-options-before`| `vendor/ibexa/page-builder/src/bundle/Resources/views/page_builder/infobar/base.html.twig` | |
| 93 | + |
| 94 | +## Order Management [[% include 'snippets/commerce_badge.md' %]] |
| 95 | + |
| 96 | +| Group name | Template file | |
| 97 | +|---|---| |
| 98 | +|`admin-ui-order-details-summary-stats`| `vendor/ibexa/order-management/src/bundle/Resources/views/themes/admin/order_management/order/details_summary.html.twig` | |
| 99 | +|`admin-ui-order-details-summary-grid`| `vendor/ibexa/order-management/src/bundle/Resources/views/themes/admin/order_management/order/details_summary.html.twig` | |
| 100 | + |
| 101 | +## Payments [[% include 'snippets/commerce_badge.md' %]] |
| 102 | + |
| 103 | +| Group name | Template file | |
| 104 | +|---|---| |
| 105 | +|`admin-ui-payment-method-tabs`| `vendor/ibexa/payment/src/bundle/Resources/views/themes/admin/payment_method/view.html.twig` | |
| 106 | + |
| 107 | +## Shipping [[% include 'snippets/commerce_badge.md' %]] |
| 108 | + |
| 109 | +| Group name | Template file | |
| 110 | +|---|---| |
| 111 | +|`admin-ui-shipment-summary-grid`| `vendor/ibexa/shipping/src/bundle/Resources/views/themes/admin/shipment/tab/summary.html.twig` | |
| 112 | +|`admin-ui-shipping-method-block`| `vendor/ibexa/shipping/src/bundle/Resources/views/themes/admin/shipping/shipping_method/view.html.twig` | |
| 113 | + |
| 114 | +## AI Actions [[% include 'snippets/lts-update_badge.md' %]] |
| 115 | + |
| 116 | +| Group name | Template file | |
| 117 | +|---|---| |
| 118 | +|`admin-ui-action-configuration-tabs`| `vendor/ibexa/connector-ai/src/bundle/Resources/views/themes/admin/connector_ai/action_configuration/view.html.twig` | |
| 119 | + |
0 commit comments