Skip to content

Commit a1809a7

Browse files
committed
Adjusted code samples inclusion
1 parent 4fe3431 commit a1809a7

16 files changed

Lines changed: 91 additions & 91 deletions

File tree

docs/ai_actions/extend_ai_actions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ For example, you can create a handler that connects to a translation model and u
1414
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:
1515

1616
``` php
17-
[[= include_file('code_samples/ai_actions/src/Command/AddMissingAltTextCommand.php', 105, 124) =]]
17+
[[= include_file('code_samples/ai_actions/src/Command/AddMissingAltTextCommand.php', 104, 131) =]]
1818
```
1919

2020
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.

docs/api/php_api/php_api.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ While [using `sudo()`](#using-sudo) is the recommended option, you can also set
126126
To identify as a different user, you need to use the `UserService` together with `PermissionResolver` (in the example `admin` is the login of the administrator user):
127127

128128
``` php
129-
[[= include_file('code_samples/api/public_php_api/src/Command/CreateContentCommand.php', 55, 57) =]]
129+
[[= include_file('code_samples/api/public_php_api/src/Command/CreateContentCommand.php', 40, 41) =]]
130130
```
131131

132132
!!! tip

docs/content_management/content_api/browsing_content.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,16 @@ This value object provides primitive fields, such as `contentTypeId`, `published
2525

2626
You can also use it to request other Content-related value objects from various services:
2727

28-
``` php hl_lines="10"
28+
``` php hl_lines="8"
2929
// ...
3030
[[= include_file('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 4, 5) =]]
31-
[[= include_file('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 20, 22) =]]
31+
[[= include_file('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 18, 22) =]]
3232
// ...
33-
[[= include_file('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 55, 57) =]][[= include_file('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 63, 72) =]]
33+
[[= include_file('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 44, 46) =]][[= include_file('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 54, 65) =]]
3434
```
3535

3636

37-
`ContentInfo` is loaded from the [`ContentService`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-ContentService.html) (line 9).
37+
`ContentInfo` is loaded from the [`ContentService`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-ContentService.html) (line 8).
3838
It provides you with basic content metadata such as modification and publication dates or main language code.
3939

4040
!!! note "Retrieving content information in a controller"
@@ -46,7 +46,7 @@ It provides you with basic content metadata such as modification and publication
4646
To get the locations of a content item you need to make use of the [`LocationService`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-LocationService.html):
4747

4848
``` php
49-
[[= include_file('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 73, 77) =]] }
49+
[[= include_file('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 55, 61) =]]
5050
```
5151

5252
[`LocationService::loadLocations`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-LocationService.html#method_loadLocations) uses `ContentInfo` to get all the locations of a content item.

docs/content_management/content_api/creating_content.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,18 @@ Value objects such as content items are read-only, so to create or modify them y
2020
[`ContentService::newContentCreateStruct`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-ContentService.html#method_newContentCreateStruct)
2121
returns a new [`ContentCreateStruct`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Values-Content-ContentCreateStruct.html) object.
2222

23-
``` php hl_lines="2-3 5"
24-
[[= include_file('code_samples/api/public_php_api/src/Command/CreateContentCommand.php', 62, 71) =]]
23+
``` php hl_lines="1-2 6"
24+
[[= include_file('code_samples/api/public_php_api/src/Command/CreateContentCommand.php', 47, 53) =]]
2525
```
2626

27-
This command creates a draft using [`ContentService::createContent`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-ContentService.html#method_createContent) (line 7).
27+
This command creates a draft using [`ContentService::createContent`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-ContentService.html#method_createContent) (line 6).
2828
This method must receive a `ContentCreateStruct` and an array of location structs.
2929

30-
`ContentCreateStruct` (which extends `ContentStruct`) is created through [`ContentService::newContentCreateStruct`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-ContentService.html#method_newContentCreateStruct) (line 2),
30+
`ContentCreateStruct` (which extends `ContentStruct`) is created through [`ContentService::newContentCreateStruct`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-ContentService.html#method_newContentCreateStruct) (line 1),
3131
which receives the content type and the primary language for the content item.
3232
For information about translating a content item into other languages, see [Translating content](#translating-content).
3333

34-
[`ContentStruct::setField`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Values-Content-ContentStruct.html#method_setField) (line 3) enables you to define the field values.
34+
[`ContentStruct::setField`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Values-Content-ContentStruct.html#method_setField) (line 2) enables you to define the field values.
3535
When the field accepts a simple value, you can provide it directly, as in the example above.
3636
For some field types, for example [images](#creating-an-image), you need to provide an instance of a Value type.
3737

@@ -42,7 +42,7 @@ Therefore, when creating a content item of the Image type (or any other content
4242
the `ContentCreateStruct` is slightly more complex than in the previous example:
4343

4444
``` php
45-
[[= include_file('code_samples/api/public_php_api/src/Command/CreateImageCommand.php', 61, 74) =]]
45+
[[= include_file('code_samples/api/public_php_api/src/Command/CreateImageCommand.php', 47, 62) =]]
4646
```
4747

4848
Value of the Image field type contains the path to the image file and other basic information based on the input file.
@@ -66,7 +66,7 @@ To publish it, use [`ContentService::publishVersion`](/api/php_api/php_api_refer
6666
This method must get the [`VersionInfo`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Values-Content-VersionInfo.html) object of a draft version.
6767

6868
``` php
69-
[[= include_file('code_samples/api/public_php_api/src/Command/CreateContentCommand.php', 73, 74) =]]
69+
[[= include_file('code_samples/api/public_php_api/src/Command/CreateContentCommand.php', 58, 59) =]]
7070
```
7171

7272
## Updating content
@@ -76,7 +76,7 @@ and pass it to [`ContentService::updateContent`](/api/php_api/php_api_reference/
7676
This method works on a draft, so to publish your changes you need to use [`ContentService::publishVersion`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-ContentService.html#method_publishVersion) as well:
7777

7878
``` php
79-
[[= include_file('code_samples/api/public_php_api/src/Command/UpdateContentCommand.php', 52, 60) =]]
79+
[[= include_file('code_samples/api/public_php_api/src/Command/UpdateContentCommand.php', 45, 50) =]]
8080
```
8181

8282
## Translating content
@@ -86,15 +86,15 @@ Content [translations](languages.md#language-versions) are created per version.
8686
To translate a content item to a new language, you need to update it and provide a new `initialLanguageCode`:
8787

8888
``` php
89-
[[= include_file('code_samples/api/public_php_api/src/Command/TranslateContentCommand.php', 57, 62) =]]
90-
[[= include_file('code_samples/api/public_php_api/src/Command/TranslateContentCommand.php', 67, 69) =]]
89+
[[= include_file('code_samples/api/public_php_api/src/Command/TranslateContentCommand.php', 50, 52) =]]
90+
[[= include_file('code_samples/api/public_php_api/src/Command/TranslateContentCommand.php', 58, 60) =]]
9191
```
9292

9393
You can also update content in multiple languages at once using the `setField` method's third argument.
9494
Only one language can still be set as a version's initial language:
9595

9696
``` php
97-
[[= include_file('code_samples/api/public_php_api/src/Command/TranslateContentCommand.php', 64, 65) =]]
97+
[[= include_file('code_samples/api/public_php_api/src/Command/TranslateContentCommand.php', 55, 55) =]]
9898
```
9999

100100
### Deleting a translation

docs/content_management/content_api/managing_content.md

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ Creating a new location, like creating content, requires using a struct, because
2222
To add a new location to existing content you need to create a [`LocationCreateStruct`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Values-Content-LocationCreateStruct.html) and pass it to the [`LocationService::createLocation`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-LocationService.html#method_createLocation) method:
2323

2424
``` php
25-
[[= include_file('code_samples/api/public_php_api/src/Command/AddLocationToContentCommand.php', 55, 56) =]]
26-
[[= include_file('code_samples/api/public_php_api/src/Command/AddLocationToContentCommand.php', 60, 62) =]]
25+
[[= include_file('code_samples/api/public_php_api/src/Command/AddLocationToContentCommand.php', 43, 43) =]]
26+
[[= include_file('code_samples/api/public_php_api/src/Command/AddLocationToContentCommand.php', 48, 49) =]]
2727
```
2828

2929
`LocationCreateStruct` must receive the parent location ID.
@@ -32,7 +32,7 @@ It sets the `parentLocationId` property of the new location.
3232
You can also provide other properties for the location, otherwise they're set to their defaults:
3333

3434
``` php
35-
[[= include_file('code_samples/api/public_php_api/src/Command/AddLocationToContentCommand.php', 57, 59) =]]
35+
[[= include_file('code_samples/api/public_php_api/src/Command/AddLocationToContentCommand.php', 45, 46) =]]
3636
```
3737

3838
### Changing the main location
@@ -41,15 +41,15 @@ When a content item has more that one location, one location is always considere
4141
You can change the main location using [`ContentService`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-ContentService.html), by updating the `ContentInfo` with a [`ContentUpdateStruct`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Values-Content-ContentUpdateStruct.html) that sets the new main location:
4242

4343
``` php
44-
[[= include_file('code_samples/api/public_php_api/src/Command/SetMainLocationCommand.php', 53, 57) =]]
44+
[[= include_file('code_samples/api/public_php_api/src/Command/SetMainLocationCommand.php', 44, 47) =]]
4545
```
4646

4747
### Hiding and revealing locations
4848

4949
To hide or reveal (unhide) a location you need to make use of [`LocationService::hideLocation`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-LocationService.html#method_hideLocation) or [`LocationService::unhideLocation`:](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-LocationService.html#method_unhideLocation)
5050

5151
``` php
52-
[[= include_file('code_samples/api/public_php_api/src/Command/HideLocationCommand.php', 51, 52) =]][[= include_file('code_samples/api/public_php_api/src/Command/HideLocationCommand.php', 54, 55) =]]
52+
[[= include_file('code_samples/api/public_php_api/src/Command/HideLocationCommand.php', 42, 42) =]][[= include_file('code_samples/api/public_php_api/src/Command/HideLocationCommand.php', 45, 45) =]]
5353
```
5454

5555
See [location visibility](locations.md#location-visibility) for detailed information on the behavior of visible and hidden Locations.
@@ -66,22 +66,22 @@ Content which has more locations is still available in its other locations.
6666
If you delete the [main location](#changing-the-main-location) of a content item that has more locations, another location becomes the main one.
6767

6868
``` php
69-
[[= include_file('code_samples/api/public_php_api/src/Command/DeleteContentCommand.php', 49, 50) =]]
69+
[[= include_file('code_samples/api/public_php_api/src/Command/DeleteContentCommand.php', 40, 40) =]]
7070
```
7171

7272
To send the location and its subtree to Trash, use [`TrashService::trash`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-TrashService.html#).
7373
Items in Trash can be later [restored, or deleted permanently](#trash).
7474

7575
``` php
76-
[[= include_file('code_samples/api/public_php_api/src/Command/TrashContentCommand.php', 59, 60) =]]
76+
[[= include_file('code_samples/api/public_php_api/src/Command/TrashContentCommand.php', 47, 47) =]]
7777
```
7878

7979
### Moving and copying a subtree
8080

8181
You can move a location with its whole subtree using [`LocationService::moveSubtree`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-LocationService.html#method_moveSubtree):
8282

8383
``` php
84-
[[= include_file('code_samples/api/public_php_api/src/Command/MoveContentCommand.php', 51, 54) =]]
84+
[[= include_file('code_samples/api/public_php_api/src/Command/MoveContentCommand.php', 42, 44) =]]
8585
```
8686

8787
[`LocationService::copySubtree`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-LocationService.html#method_copySubtree) is used in the same way, but it copies the location and its subtree instead of moving it.
@@ -108,7 +108,7 @@ You must provide the method with the ID of the object in Trash.
108108
Trash location is identical to the origin location of the object.
109109

110110
``` php
111-
[[= include_file('code_samples/api/public_php_api/src/Command/TrashContentCommand.php', 69, 70) =]]
111+
[[= include_file('code_samples/api/public_php_api/src/Command/TrashContentCommand.php', 56, 57) =]]
112112
```
113113

114114
The content item is restored under its previous location.
@@ -138,29 +138,29 @@ In this case you use [`ContentTypeCreateStruct`](/api/php_api/php_api_reference/
138138
A content type must have at least one name, in the main language, and at least one field definition.
139139

140140
``` php
141-
[[= include_file('code_samples/api/public_php_api/src/Command/CreateContentTypeCommand.php', 64, 74) =]][[= include_file('code_samples/api/public_php_api/src/Command/CreateContentTypeCommand.php', 81, 90) =]]
141+
[[= include_file('code_samples/api/public_php_api/src/Command/CreateContentTypeCommand.php', 55, 62) =]][[= include_file('code_samples/api/public_php_api/src/Command/CreateContentTypeCommand.php', 74, 79) =]]
142142
```
143143

144144
You can specify more details of the field definition in the create struct, for example:
145145

146146
``` php
147-
[[= include_file('code_samples/api/public_php_api/src/Command/CreateContentTypeCommand.php', 72, 82) =]]
147+
[[= include_file('code_samples/api/public_php_api/src/Command/CreateContentTypeCommand.php', 63, 72) =]]
148148
```
149149

150150
### Copying content types
151151

152152
To copy a content type, use [`ContentTypeService::copyContentType`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-ContentTypeService.html#method_copyContentType):
153153

154154
``` php
155-
[[= include_file('code_samples/api/public_php_api/src/Command/CreateContentTypeCommand.php', 94, 95) =]]
155+
[[= include_file('code_samples/api/public_php_api/src/Command/CreateContentTypeCommand.php', 83, 85) =]]
156156
```
157157

158158
The copy is automatically getting an identifier based on the original content type identifier and the copy's ID, for example: `copy_of_folder_21`.
159159

160160
To change the identifier of the copy, use a [`ContentTypeUpdateStruct`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Values-ContentType-ContentTypeUpdateStruct.html):
161161

162162
``` php
163-
[[= include_file('code_samples/api/public_php_api/src/Command/CreateContentTypeCommand.php', 95, 101) =]]
163+
[[= include_file('code_samples/api/public_php_api/src/Command/CreateContentTypeCommand.php', 86, 91) =]]
164164
```
165165

166166
## Calendar events
@@ -177,19 +177,19 @@ To get a list of events for a specified time period, use the `CalendarServiceInt
177177
You need to provide the method with an EventQuery, which takes a date range and a count as the minimum of parameters:
178178

179179
``` php
180-
[[= include_file('code_samples/api/public_php_api/src/Command/CalendarCommand.php', 44, 55) =]]
180+
[[= include_file('code_samples/api/public_php_api/src/Command/CalendarCommand.php', 35, 45) =]]
181181
```
182182

183183
You can also get the first and last event in the list by using the `first()` and `last()` methods of an `EventCollection` (`Ibexa\Contracts\Calendar\EventCollection`):
184184

185185
``` php
186-
[[= include_file('code_samples/api/public_php_api/src/Command/CalendarCommand.php', 56, 58) =]]
186+
[[= include_file('code_samples/api/public_php_api/src/Command/CalendarCommand.php', 47, 48) =]]
187187
```
188188

189189
You can process the events in a collection using the `find(Closure $predicate)`, `filter(Closure $predicate)`, `map(Closure $callback)` or `slice(int $offset, ?int $length = null)` methods of `EventCollection`, for example:
190190

191191
``` php
192-
[[= include_file('code_samples/api/public_php_api/src/Command/CalendarCommand.php', 59, 62) =]]
192+
[[= include_file('code_samples/api/public_php_api/src/Command/CalendarCommand.php', 50, 53) =]]
193193
```
194194

195195
### Performing calendar actions
@@ -199,7 +199,7 @@ You must pass an `Ibexa\Contracts\Calendar\EventAction\EventActionContext` insta
199199
`EventActionContext` defines events on which the action is performed, and action-specific parameters, for example, a new date:
200200

201201
``` php
202-
[[= include_file('code_samples/api/public_php_api/src/Command/CalendarCommand.php', 64, 66) =]]
202+
[[= include_file('code_samples/api/public_php_api/src/Command/CalendarCommand.php', 55, 58) =]]
203203
```
204204

205205
``` php

docs/content_management/content_management_api/bookmark_api.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,17 @@ description: You can use the PHP API to view the bookmark list, and add or remov
1313
To view a list of all bookmarks, use [`BookmarkService::loadBookmarks`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-BookmarkService.html#method_loadBookmarks):
1414

1515
``` php
16-
[[= include_file('code_samples/api/public_php_api/src/Command/BookmarkCommand.php', 48, 55) =]]
16+
[[= include_file('code_samples/api/public_php_api/src/Command/BookmarkCommand.php', 42, 48) =]]
1717
```
1818

1919
You can add a bookmark to a content item by providing its Location object to the [`BookmarkService::createBookmark`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-BookmarkService.html#method_createBookmark) method:
2020

2121
``` php
22-
[[= include_file('code_samples/api/public_php_api/src/Command/BookmarkCommand.php', 42, 45) =]]
22+
[[= include_file('code_samples/api/public_php_api/src/Command/BookmarkCommand.php', 38, 40) =]]
2323
```
2424

2525
You can remove a bookmark from a location with [`BookmarkService::deleteBookmark`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-BookmarkService.html#method_deleteBookmark):
2626

2727
``` php
28-
[[= include_file('code_samples/api/public_php_api/src/Command/BookmarkCommand.php', 57, 58) =]]
28+
[[= include_file('code_samples/api/public_php_api/src/Command/BookmarkCommand.php', 51, 51) =]]
2929
```

0 commit comments

Comments
 (0)