Skip to content

Commit

Permalink
Fix line numbers (#2256)
Browse files Browse the repository at this point in the history
* browsing_content.md: Fix line numbers
* creating_content.md: Fix line numbers
* search_api.md: Fix line numbers

(cherry picked from commit cb59d52)
  • Loading branch information
adriendupuis committed Dec 22, 2023
1 parent 00631fd commit f829ecf
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
10 changes: 5 additions & 5 deletions docs/content_management/content_api/browsing_content.md
Original file line number Diff line number Diff line change
Expand Up @@ -168,10 +168,10 @@ To retrieve the Fields of the selected Content item, you can use the following c
}
```

Line 16 shows how [`ContentService::loadContent`](https://github.com/ibexa/core/blob/main/src/contracts/Repository/ContentService.php#L147) loads the Content item provided to the command.
Line 17 makes use of the [`ContentTypeService`](https://github.com/ibexa/core/blob/main/src/contracts/Repository/ContentTypeService.php) to retrieve the Content Type of the requested item.
Line 9 shows how [`ContentService::loadContent`](https://github.com/ibexa/core/blob/main/src/contracts/Repository/ContentService.php#L147) loads the Content item provided to the command.
Line 14 makes use of the [`ContentTypeService`](https://github.com/ibexa/core/blob/main/src/contracts/Repository/ContentTypeService.php) to retrieve the Content Type of the requested item.

Lines 19-24 iterate over Fields defined by the Content Type.
Lines 12-19 iterate over Fields defined by the Content Type.
For each Field they print out its identifier, and then using [`FieldTypeService`](https://github.com/ibexa/core/blob/main/src/contracts/Repository/FieldTypeService.php) retrieve the Field's value and print it out to the console.

## Viewing content in different languages
Expand Down Expand Up @@ -199,9 +199,9 @@ you need to use the [`LocationService`.](https://github.com/ibexa/core/blob/main
[[= include_file('code_samples/api/public_php_api/src/Command/BrowseLocationsCommand.php', 30, 49) =]]
```

`loadLocation` (line 14) returns a value object, here a `Location`.
`loadLocation` (line 15) returns a value object, here a `Location`.

[`LocationService::loadLocationChildren`](https://github.com/ibexa/core/blob/main/src/contracts/Repository/LocationService.php#L106) (line 23)
[`LocationService::loadLocationChildren`](https://github.com/ibexa/core/blob/main/src/contracts/Repository/LocationService.php#L106) (line 5)
returns a [`LocationList`](https://github.com/ibexa/core/blob/main/src/contracts/Repository/Values/Content/LocationList.php) value object that you can iterate over.

!!! note
Expand Down
6 changes: 3 additions & 3 deletions docs/content_management/content_api/creating_content.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ returns a new [`ContentCreateStruct`](https://github.com/ibexa/core/blob/main/sr
[[= include_file('code_samples/api/public_php_api/src/Command/CreateContentCommand.php', 57, 66) =]]
```

This command creates a draft using [`ContentService::createContent`](https://github.com/ibexa/core/blob/main/src/contracts/Repository/ContentService.php#L210) (line 21).
This command creates a draft using [`ContentService::createContent`](https://github.com/ibexa/core/blob/main/src/contracts/Repository/ContentService.php#L210) (line 7).
This method must receive a `ContentCreateStruct` and an array of Location structs.

`ContentCreateStruct` (which extends `ContentStruct`) is created through [`ContentService::newContentCreateStruct`](https://github.com/ibexa/core/blob/main/src/contracts/Repository/ContentService.php#L533) (line 17),
`ContentCreateStruct` (which extends `ContentStruct`) is created through [`ContentService::newContentCreateStruct`](https://github.com/ibexa/core/blob/main/src/contracts/Repository/ContentService.php#L533) (line 2),
which receives the Content Type and the primary language for the Content item.
For information about translating a Content item into other languages, see [Translating content](#translating-content).

[`ContentStruct::setField`](https://github.com/ibexa/core/blob/main/src/contracts/Repository/Values/Content/ContentStruct.php#L32) (line 18) enables you to define the Field values.
[`ContentStruct::setField`](https://github.com/ibexa/core/blob/main/src/contracts/Repository/Values/Content/ContentStruct.php#L32) (line 3) enables you to define the Field values.
When the Field accepts a simple value, you can provide it directly, as in the example above.
For some Field Types, for example [images](#creating-an-image), you need to provide an instance of a Value type.

Expand Down
10 changes: 5 additions & 5 deletions docs/search/search_api.md
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ For example, in the code below, `locationId` is provided to list all children of
[[= include_file('code_samples/api/public_php_api/src/Controller/CustomController.php', 18, 34) =]]
```

The rendering of results is then relegated to [templates](templates.md) (lines 20-22).
The rendering of results is then relegated to [templates](templates.md) (lines 21-23).

When using Repository filtering, provide the results of `ContentService::find()` as parameters to the view:

Expand Down Expand Up @@ -250,15 +250,15 @@ For more complex searches, you need to combine multiple Criteria.
You can do it using logical operators: `LogicalAnd`, `LogicalOr`, and `LogicalNot`.

``` php
[[= include_file('code_samples/api/public_php_api/src/Command/FindComplexCommand.php', 43, 49) =]][[= include_file('code_samples/api/public_php_api/src/Command/FindComplexCommand.php', 52, 53) =]]
[[= include_file('code_samples/api/public_php_api/src/Command/FindComplexCommand.php', 59, 64) =]]
[[= include_file('code_samples/api/public_php_api/src/Command/FindComplexCommand.php', 43, 49) =]][[= include_file('code_samples/api/public_php_api/src/Command/FindComplexCommand.php', 53, 54) =]]
[[= include_file('code_samples/api/public_php_api/src/Command/FindComplexCommand.php', 60, 65) =]]
```

This example takes three parameters from a command — `$text`, `$contentTypeId`, and `$locationId`.
It then combines them using `Criterion\LogicalAnd` to search for Content items
that belong to a specific subtree, have the chosen Content Type and contain the provided text (lines 6-8).
that belong to a specific subtree, have the chosen Content Type and contain the provided text (lines 3-6).

This also shows that you can get the total number of search results using the `totalCount` property of search results (line 11).
This also shows that you can get the total number of search results using the `totalCount` property of search results (line 9).

You can also nest different operators to construct more complex queries.
The example below uses the `LogicalNot` operator to search for all content containing a given phrase
Expand Down

0 comments on commit f829ecf

Please sign in to comment.