Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/preview_comment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:

- name: Create comment for changed files
run: |
file_limit=100
file_limit=150
build_url="https://ez-systems-developer-documentation--${{ github.event.pull_request.number }}.com.readthedocs.build/${{inputs.project}}en/${{ github.event.pull_request.number }}/"

md_change_list=$(git diff --name-only HEAD "origin/$GITHUB_BASE_REF" -- docs/ | grep -E "^docs\/.*\.md$" | sed -E "s|^docs/(.*)\.md$|- [docs/\1.md](${build_url}\1/)|")
Expand Down
4 changes: 2 additions & 2 deletions docs/administration/back_office/add_user_setting.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ To do so, create a setting class implementing two interfaces: `ValueDefinitionIn
In this example the class is located in `src/Setting/Unit.php` and enables the user to select their preference for metric or imperial unit systems.

``` php
[[= include_file('code_samples/back_office/settings/src/Setting/Unit.php') =]]
[[= include_code('code_samples/back_office/settings/src/Setting/Unit.php') =]]
```

Register the setting as a service:
Expand All @@ -30,7 +30,7 @@ It can be one of the built-in groups, or a custom one.
To create a custom setting group, create an `App/Setting/Group/MyGroup.php` file:

``` php
[[= include_file('code_samples/back_office/settings/src/Setting/Group/MyGroup.php') =]]
[[= include_code('code_samples/back_office/settings/src/Setting/Group/MyGroup.php') =]]
```

Register the setting group as a service:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ First, create base strategy for returning custom thumbnails from a static file.
Create `StaticStrategy.php` in `src/Strategy`.

```php
[[= include_file('code_samples/back_office/thumbnails/src/Strategy/StaticThumbnailStrategy.php') =]]
[[= include_code('code_samples/back_office/thumbnails/src/Strategy/StaticThumbnailStrategy.php') =]]
```

Next, add the strategy with the `ibexa.repository.thumbnail.strategy.content` tag and `priority: 100` to `config/services.yaml`:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ The route indicates a controller that fetches all visible content items and rend
Create the following controller file in `src/Controller/AllContentListController.php`:

``` php
[[= include_file('code_samples/back_office/menu/menu_item/src/Controller/AllContentListController.php') =]]
[[= include_code('code_samples/back_office/menu/menu_item/src/Controller/AllContentListController.php') =]]
```

## Add template
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ To add an inactive menu section, don't add a route to its parameters.
The following method adds a new menu section under **Content**, and under it, a new item with custom attributes:

``` php
[[= include_file('code_samples/back_office/menu/menu_item/src/EventSubscriber/MyMenuSubscriber.php', 30, 43) =]]
[[= include_code('code_samples/back_office/menu/menu_item/src/EventSubscriber/MyMenuSubscriber.php', 31, 43, remove_indent=True) =]]
```

`label` is used for the new menu item in the interface.
Expand Down Expand Up @@ -127,13 +127,13 @@ You can use the `extras.icon` parameter to define an icon for a menu item.
For example, the following code changes the default icon for the **Create content** button in content view:

``` php
[[= include_file('code_samples/back_office/menu/menu_item/src/EventSubscriber/MyMenuSubscriber.php', 46, 48) =]]
[[= include_code('code_samples/back_office/menu/menu_item/src/EventSubscriber/MyMenuSubscriber.php', 47, 48, remove_indent=True) =]]
```

## Removing menu items

To remove a menu item, for example, to remove the **Copy subtree** item from the right menu in content view, use the following event listener:

``` php
[[= include_file('code_samples/back_office/menu/menu_item/src/EventSubscriber/MyMenuSubscriber.php', 44, 45) =]]
[[= include_code('code_samples/back_office/menu/menu_item/src/EventSubscriber/MyMenuSubscriber.php', 45, 45, remove_indent=True) =]]
```
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ You can order the tabs by making the tab implement `OrderedTabInterface`.
The order depends on the numerical value returned by the `getOrder` method:

``` php
[[= include_file('code_samples/back_office/dashboard/article_tab/src/Tab/Dashboard/Everyone/EveryoneArticleTab.php', 37, 41) =]]
[[= include_code('code_samples/back_office/dashboard/article_tab/src/Tab/Dashboard/Everyone/EveryoneArticleTab.php', 38, 41, remove_indent=True) =]]
```

Tabs are displayed according to this value in ascending order.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ To create a new tab in the dashboard, create an `EveryoneArticleTab.php` file in
This adds a tab to the **Common content** dashboard block that displays all articles in the repository.

``` php hl_lines="17 38 50-53 64-66"
[[= include_file('code_samples/back_office/dashboard/article_tab/src/Tab/Dashboard/Everyone/EveryoneArticleTab.php') =]]
[[= include_code('code_samples/back_office/dashboard/article_tab/src/Tab/Dashboard/Everyone/EveryoneArticleTab.php') =]]
```

This tab searches for content with content type "Article" (lines 50-53) and uses the built-in `all_content.html.twig` template to render the results, which ensures that the tab looks the same as the existing tabs (lines 64-66).
Expand Down
2 changes: 1 addition & 1 deletion docs/administration/back_office/content_tab_switcher.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ The `meta_field_groups_list` configuration can be overridden.
First, create an event listener in the `src/EventListener/TextAnchorMenuTabListener.php`:

``` php hl_lines="28 31"
[[= include_file('code_samples/back_office/content_type/src/EventListener/TextAnchorMenuTabListener.php') =]]
[[= include_code('code_samples/back_office/content_type/src/EventListener/TextAnchorMenuTabListener.php') =]]
```

A new custom tab is defined in the line 28, the line 31 defines items for the second level.
Expand Down
6 changes: 3 additions & 3 deletions docs/administration/back_office/customize_calendar.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,15 @@ The following example shows how to create custom events which add different holi
First, create a new event in `src/Calendar/Holidays/Event.php`:

``` php
[[= include_file('code_samples/back_office/calendar/src/Calendar/Holidays/Event.php') =]]
[[= include_code('code_samples/back_office/calendar/src/Calendar/Holidays/Event.php') =]]
```

Here, you define a new class for your event based on `Ibexa\Contracts\Calendar\Event`.

Next, create `src/Calendar/Holidays/EventType.php`:

```php hl_lines="20-23"
[[= include_file('code_samples/back_office/calendar/src/Calendar/Holidays/EventType.php') =]]
[[= include_code('code_samples/back_office/calendar/src/Calendar/Holidays/EventType.php') =]]
```

You can use the identifier defined in lines 20-23 to configure [event colors](#customize-colors-and-icons).
Expand Down Expand Up @@ -109,7 +109,7 @@ To do this, place the following `holidays.json` file in `src/Calendar/Holidays`:
Next, import this file in `src/Calendar/Holidays/EventSourceFactory.php`:

``` php hl_lines="6-9"
[[= include_file('code_samples/back_office/calendar/src/Calendar/Holidays/EventSourceFactory.php', 16, 30) =]]
[[= include_code('code_samples/back_office/calendar/src/Calendar/Holidays/EventSourceFactory.php', 17, 30, remove_indent=True) =]]
```

The calendar now displays the events listed in the JSON file.
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ In this example, it removes a product roadmap entry from the menu and adds a hel
The tab is displayed in a production environment only.

``` php
[[= include_file('code_samples/back_office/menu/menu_item/src/EventSubscriber/HelpMenuSubscriber.php') =]]
[[= include_code('code_samples/back_office/menu/menu_item/src/EventSubscriber/HelpMenuSubscriber.php') =]]
```

!!! tip
Expand Down
2 changes: 1 addition & 1 deletion docs/administration/back_office/customize_product_tour.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ ibexa:
Then, create a subscriber that modifies the scenario.

```php hl_lines="32-34 36-38 40-42 44-55"
[[= include_file('code_samples/back_office/product_tour/src/EventSubscriber/NotificationScenarioSubscriber.php') =]]
[[= include_code('code_samples/back_office/product_tour/src/EventSubscriber/NotificationScenarioSubscriber.php') =]]
```

The subscriber executes the following actions:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ It also implements `TranslationContainerInterface::getTranslationMessages` to pr
Create the `src/Search/SortingDefinition/Provider/SectionNameSortingDefinitionProvider.php` file:

``` php hl_lines="22"
[[= include_file('code_samples/back_office/search/src/Search/SortingDefinition/Provider/SectionNameSortingDefinitionProvider.php') =]]
[[= include_code('code_samples/back_office/search/src/Search/SortingDefinition/Provider/SectionNameSortingDefinitionProvider.php') =]]
```

Then add a service definition to `config/services.yaml`:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ This example event subscriber is implemented in the `src/EventSubscriber/MySugge
It uses [`ProductService::findProducts`](product_api.md#products), and returns the received event after having manipulated the `SuggestionCollection`:

``` php
[[= include_file('code_samples/back_office/search/src/EventSubscriber/MySuggestionEventSubscriber.php') =]]
[[= include_code('code_samples/back_office/search/src/EventSubscriber/MySuggestionEventSubscriber.php') =]]
```

To have the logger injected thanks to the `LoggerAwareTrait`, this subscriber must be registered as a service:
Expand All @@ -60,7 +60,7 @@ services:
To represent the product suggestion data, a `ProductSuggestion` class is created in `src/Search/Model/Suggestion/ProductSuggestion.php`:

``` php
[[= include_file('code_samples/back_office/search/src/Search/Model/Suggestion/ProductSuggestion.php') =]]
[[= include_code('code_samples/back_office/search/src/Search/Model/Suggestion/ProductSuggestion.php') =]]
```

This representation needs a normalizer to be transformed into a JSON.
Expand All @@ -70,7 +70,7 @@ Alongside data about the product, this array must have a `type` key, whose value
In `src/Search/Serializer/Normalizer/Suggestion/ProductSuggestionNormalizer.php`:

``` php
[[= include_file('code_samples/back_office/search/src/Search/Serializer/Normalizer/Suggestion/ProductSuggestionNormalizer.php') =]]
[[= include_code('code_samples/back_office/search/src/Search/Serializer/Normalizer/Suggestion/ProductSuggestionNormalizer.php') =]]
```

This normalizer is added to suggestion normalizers by decorating `ibexa.search.suggestion.serializer` and redefining its list of normalizers:
Expand Down
6 changes: 3 additions & 3 deletions docs/administration/back_office/notifications.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ To create a new notification you can use the [`NotificationService::createNotifi
like in the example below:

```php
[[= include_file('code_samples/back_office/notifications/src/EventListener/ContentPublishEventListener.php') =]]
[[= include_code('code_samples/back_office/notifications/src/EventListener/ContentPublishEventListener.php') =]]
```

A new type of user notification is created: `ContentPublished`.
Expand All @@ -103,7 +103,7 @@ To display a user notification, write a renderer and tag it as a service.
The example below presents a renderer that uses Twig to render a view:

```php
[[= include_file('code_samples/back_office/notifications/src/Notification/MyRenderer.php') =]]
[[= include_code('code_samples/back_office/notifications/src/Notification/MyRenderer.php') =]]
```

You can add the template that is used in the `MyRenderer::render()` method to the `admin` theme
Expand All @@ -127,7 +127,7 @@ To display a list of notifications, expand the above renderer.
The example below presents a modified renderer that uses Twig to render a list view:

```php
[[= include_file('code_samples/back_office/notifications/src/Notification/ListRenderer.php') =]]
[[= include_code('code_samples/back_office/notifications/src/Notification/ListRenderer.php') =]]
```

### `ibexa` notification channel
Expand Down
2 changes: 1 addition & 1 deletion docs/administration/dashboard/php_api_dashboard_service.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ First argument is the `Content ID` of the dashboard to copy.
Following arguments are the Content IDs of the user groups.

``` php hl_lines="61"
[[= include_file('code_samples/back_office/dashboard/src/Command/DashboardCommand.php') =]]
[[= include_code('code_samples/back_office/dashboard/src/Command/DashboardCommand.php') =]]
```

The following line runs the command with `74` as the model dashboard's Content ID, `13` the user group's Content ID, and on the SiteAccess `admin` to have the right `user_content_type_identifier` config:
Expand Down
32 changes: 16 additions & 16 deletions docs/ai_actions/extend_ai_actions.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ For example, you can create a handler that connects to a translation model and u
You can execute AI Actions by using the [ActionServiceInterface](/api/php_api/php_api_reference/classes/Ibexa-Contracts-ConnectorAi-ActionServiceInterface.html) service, as in the following example:

``` php
[[= include_file('code_samples/ai_actions/src/Command/AddMissingAltTextCommand.php', 86, 105, remove_indent=True) =]]
[[= include_code('code_samples/ai_actions/src/Command/AddMissingAltTextCommand.php', 87, 105, remove_indent=True) =]]
```

The `GenerateAltTextAction` is a built-in action that implements the [ActionInterface](/api/php_api/php_api_reference/classes/Ibexa-Contracts-ConnectorAi-ActionInterface.html), takes an [Image](/api/php_api/php_api_reference/classes/Ibexa-Contracts-ConnectorAi-Action-DataType-Image.html) as an input, and generates the alternative text in the response.
Expand Down Expand Up @@ -44,7 +44,7 @@ Below you can find the full example of a Symfony Command, together with a matchi
The command finds the images modified in the last 24 hours, and adds the alternative text to them if it's missing.

``` php hl_lines="72 85-110"
[[= include_file('code_samples/ai_actions/src/Command/AddMissingAltTextCommand.php') =]]
[[= include_code('code_samples/ai_actions/src/Command/AddMissingAltTextCommand.php') =]]
```

``` yaml
Expand Down Expand Up @@ -77,7 +77,7 @@ See [Action Configuration Search Criteria reference](action_configuration_criter
The following example creates a new Action Configuration:

``` php hl_lines="3 17"
[[= include_file('code_samples/ai_actions/src/Command/ActionConfigurationCreateCommand.php', 46, 63, remove_indent=True) =]]
[[= include_code('code_samples/ai_actions/src/Command/ActionConfigurationCreateCommand.php', 47, 63, remove_indent=True) =]]
```

Actions Configurations are tied to a specific Action Type and are translatable.
Expand All @@ -88,7 +88,7 @@ Reuse existing Action Configurations to simplify the execution of AI Actions.
You can pass one directly to the `ActionServiceInterface::execute()` method:

``` php hl_lines="7-8"
[[= include_file('code_samples/ai_actions/src/Command/ActionConfigurationCreateCommand.php', 64, 72, remove_indent=True) =]]
[[= include_code('code_samples/ai_actions/src/Command/ActionConfigurationCreateCommand.php', 65, 72, remove_indent=True) =]]
```

The passed Action Configuration is only taken into account if the Action Context was not passed to the Action directly using the [ActionInterface::setActionContext()](/api/php_api/php_api_reference/classes/Ibexa-Contracts-ConnectorAi-ActionInterface.html#method_hasActionContext) method.
Expand Down Expand Up @@ -117,7 +117,7 @@ Create a class implementing the [ActionHandlerInterface](/api/php_api/php_api_re
See the code sample below, together with a matching service definition:

``` php hl_lines="17 25-28 30-65 67-70"
[[= include_file('code_samples/ai_actions/src/AI/Handler/LLaVaTextToTextActionHandler.php') =]]
[[= include_code('code_samples/ai_actions/src/AI/Handler/LLaVaTextToTextActionHandler.php') =]]
```

``` yaml
Expand All @@ -137,7 +137,7 @@ Form configuration makes the Handler configurable by using the back office.
The example handler uses the `system_prompt` option, which becomes part of the Action Configuration UI thanks to the following code:

``` php hl_lines="16-20"
[[= include_file('code_samples/ai_actions/src/Form/Type/TextToTextOptionsType.php') =]]
[[= include_code('code_samples/ai_actions/src/Form/Type/TextToTextOptionsType.php') =]]
```

``` yaml
Expand Down Expand Up @@ -180,7 +180,7 @@ The class needs to define following parameters of the Action Type:
- Action object

``` php
[[= include_file('code_samples/ai_actions/src/AI/ActionType/TranscribeAudioActionType.php') =]]
[[= include_code('code_samples/ai_actions/src/AI/ActionType/TranscribeAudioActionType.php') =]]
```

``` yaml
Expand All @@ -203,13 +203,13 @@ The `TranscribeAudio` Action Type requires adding two data classes that exist in
- an `Audio` class, implementing the [DataType interface](/api/php_api/php_api_reference/classes/Ibexa-Contracts-ConnectorAi-DataType.html), to store the input data for the Action

``` php
[[= include_file('code_samples/ai_actions/src/AI/DataType/Audio.php') =]]
[[= include_code('code_samples/ai_actions/src/AI/DataType/Audio.php') =]]
```

- an `TranscribeAudioAction` class, implementing the [ActionInterface interface](/api/php_api/php_api_reference/classes/Ibexa-Contracts-ConnectorAi-ActionInterface.html). Pass this object to the `ActionServiceInterface::execute()` method to execute the action.

``` php
[[= include_file('code_samples/ai_actions/src/AI/Action/TranscribeAudioAction.php') =]]
[[= include_code('code_samples/ai_actions/src/AI/Action/TranscribeAudioAction.php') =]]
```

### Create custom Action Type options form
Expand All @@ -218,7 +218,7 @@ Custom Form Type is needed if the Action Type requires additional options config
The following example adds a checkbox field that indicates to the Action Handler whether the transcription should include the timestamps.

``` php hl_lines="16-20"
[[= include_file('code_samples/ai_actions/src/Form/Type/TranscribeAudioOptionsType.php') =]]
[[= include_code('code_samples/ai_actions/src/Form/Type/TranscribeAudioOptionsType.php') =]]
```

``` yaml
Expand All @@ -234,7 +234,7 @@ The language of the transcribed data is extracted from the Runtime Context for b
The Action Type options provided in the Action Context dictate whether the timestamps will be removed before returning the result.

``` php hl_lines="34-37 52-55"
[[= include_file('code_samples/ai_actions/src/AI/Handler/WhisperAudioToTextActionHandler.php') =]]
[[= include_code('code_samples/ai_actions/src/AI/Handler/WhisperAudioToTextActionHandler.php') =]]
```

``` yaml
Expand All @@ -252,7 +252,7 @@ See [adding custom media type](adding_custom_media_type.md) and [creating new RE
Start by creating an Input Parser able to handle the `application/vnd.ibexa.api.ai.TranscribeAudio` media type.

``` php
[[= include_file('code_samples/ai_actions/src/AI/REST/Input/Parser/TranscribeAudio.php') =]]
[[= include_code('code_samples/ai_actions/src/AI/REST/Input/Parser/TranscribeAudio.php') =]]
```

``` yaml
Expand All @@ -262,7 +262,7 @@ Start by creating an Input Parser able to handle the `application/vnd.ibexa.api.
The `TranscribeAudioAction` is a value object holding the parsed request data.

``` php
[[= include_file('code_samples/ai_actions/src/AI/REST/Value/TranscribeAudioAction.php') =]]
[[= include_code('code_samples/ai_actions/src/AI/REST/Value/TranscribeAudioAction.php') =]]
```

#### Handle output data
Expand All @@ -272,14 +272,14 @@ To transform the `TranscribeAudioAction` into a REST response you need to create
- An `AudioText` value object holding the REST response data

``` php
[[= include_file('code_samples/ai_actions/src/AI/REST/Value/AudioText.php') =]]
[[= include_code('code_samples/ai_actions/src/AI/REST/Value/AudioText.php') =]]
```

- A resolver converting the Action Response returned from the PHP API layer into the `AudioText` object.
The resolver is activated when `application/vnd.ibexa.api.ai.AudioText` media type is specified in the `Accept` header:

``` php
[[= include_file('code_samples/ai_actions/src/AI/REST/Output/Resolver/AudioTextResolver.php') =]]
[[= include_code('code_samples/ai_actions/src/AI/REST/Output/Resolver/AudioTextResolver.php') =]]
```

``` yaml
Expand All @@ -290,7 +290,7 @@ The resolver is activated when `application/vnd.ibexa.api.ai.AudioText` media ty


``` php
[[= include_file('code_samples/ai_actions/src/AI/REST/Output/ValueObjectVisitor/AudioText.php') =]]
[[= include_code('code_samples/ai_actions/src/AI/REST/Output/ValueObjectVisitor/AudioText.php') =]]
```

``` yaml
Expand Down
2 changes: 1 addition & 1 deletion docs/api/event_reference/event_reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ In most cases, two events are dispatched for every action, one before the action
For example, copying a content item is connected with two events: `BeforeCopyContentEvent` and `CopyContentEvent`.

``` php
[[= include_file('code_samples/api/public_php_api/src/EventSubscriber/MyEventSubcriber.php') =]]
[[= include_code('code_samples/api/public_php_api/src/EventSubscriber/MyEventSubcriber.php') =]]
```

[[= cards([
Expand Down
Loading
Loading