Skip to content

Commit

Permalink
fix: use html for code-selector
Browse files Browse the repository at this point in the history
  • Loading branch information
soyuka committed Dec 18, 2023
1 parent bec5187 commit bc6bbab
Show file tree
Hide file tree
Showing 18 changed files with 120 additions and 120 deletions.
4 changes: 2 additions & 2 deletions core/content-negotiation.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ this configuration might disable the `json` or the `html` on this resource for e

You can specify different accepted formats at operation level too, it's especially convenient for to configure formats available for the `PATCH` method:

[codeSelector]
<code-selector>

```php
<?php
Expand Down Expand Up @@ -186,7 +186,7 @@ resources:
</resources>
```

[/codeSelector]
</code-selector>

## Supporting Custom Formats

Expand Down
16 changes: 8 additions & 8 deletions core/controllers.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ the client.

The routing has not been configured yet because we will add it at the resource configuration level:

[codeSelector]
<code-selector>

```php
<?php
Expand Down Expand Up @@ -138,7 +138,7 @@ App\Entity\Book:
</resources>
```

[/codeSelector]
</code-selector>

It is mandatory to set the `method`, `path` and `controller` attributes. They allow API Platform to configure the routing path and
the associated controller respectively.
Expand All @@ -147,7 +147,7 @@ the associated controller respectively.

You may want different serialization groups for your custom operations. Just configure the proper `normalization_context` and/or `denormalization_context` in your operation:

[codeSelector]
<code-selector>

```php
<?php
Expand Down Expand Up @@ -216,14 +216,14 @@ App\Entity\Book:
</resources>
```

[/codeSelector]
</code-selector>

## Retrieving the Entity

If you want to bypass the automatic retrieval of the entity in your custom operation, you can set `"read"=false` in the
operation attribute:

[codeSelector]
<code-selector>

```php
<?php
Expand Down Expand Up @@ -281,7 +281,7 @@ App\Entity\Book:
</resources>
```

[/codeSelector]
</code-selector>

This way, it will skip the `ReadListener`. You can do the same for some other built-in listeners. See [Built-in Event Listeners](events.md#built-in-event-listeners)
for more information.
Expand All @@ -301,7 +301,7 @@ for `book_post_discontinuation` when neither `method` nor `route_name` attribute

First, let's create your resource configuration:

[codeSelector]
<code-selector>

```php
<?php
Expand Down Expand Up @@ -350,7 +350,7 @@ App\Entity\Book:
</resources>
```

[/codeSelector]
</code-selector>

API Platform will automatically map this `post_publication` operation to the route `book_post_publication`. Let's create a custom action
and its related route using annotations:
Expand Down
4 changes: 2 additions & 2 deletions core/data-providers.md
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ API Platform provides a few extensions that you can reuse in your custom DataPro
Note that there are a few kinds of extensions which are detailed in [their own chapter of the documentation](extensions.md).
Because extensions are tagged services, you can use the [injection of tagged services](https://symfony.com/blog/new-in-symfony-3-4-simpler-injection-of-tagged-services):

[codeSelector]
<code-selector>

```yaml
services:
Expand All @@ -232,7 +232,7 @@ services:
</services>
```

[/codeSelector]
</code-selector>

Your data provider will now have access to the core extensions, here is an example on how to use them:

Expand Down
16 changes: 8 additions & 8 deletions core/default-order.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ API Platform Core provides an easy way to override the default order of items in
By default, items in the collection are ordered in ascending (ASC) order by their resource identifier(s). If you want to
customize this order, you must add an `order` attribute on your ApiResource annotation:

[codeSelector]
<code-selector>

```php
<?php
Expand Down Expand Up @@ -36,12 +36,12 @@ App\Entity\Book:
foo: ASC
```
[/codeSelector]
</code-selector>
This `order` attribute is used as an array: the key defines the order field, the values defines the direction.
If you only specify the key, `ASC` direction will be used as default. For example, to order by `foo` & `bar`:

[codeSelector]
<code-selector>

```php
<?php
Expand Down Expand Up @@ -76,11 +76,11 @@ App\Entity\Book:
order: ['foo', 'bar']
```

[/codeSelector]
</code-selector>

It's also possible to configure the default order on an association property:

[codeSelector]
<code-selector>

```php
<?php
Expand Down Expand Up @@ -110,11 +110,11 @@ App\Entity\Book:
order: ['author.username']
```

[/codeSelector]
</code-selector>

Another possibility is to apply the default order for a specific collection operation, which will override the global default order configuration.

[codeSelector]
<code-selector>

```php
#[ApiResource(
Expand Down Expand Up @@ -161,4 +161,4 @@ App\Entity\Book:
name: ASC
```

[/codeSelector]
</code-selector>
4 changes: 2 additions & 2 deletions core/deprecations.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class Parchment

It's also possible to deprecate a single property:

[codeSelector]
<code-selector>

```php
<?php
Expand Down Expand Up @@ -102,7 +102,7 @@ resources:
deprecation_reason: 'Use the rating property instead'
```
[/codeSelector]
</code-selector>
* With JSON-lD / Hydra, [an `owl:deprecated` annotation property](https://www.w3.org/TR/owl2-syntax/#Annotation_Properties) will be added to the appropriate data structure
* With Swagger / OpenAPI, [a `deprecated` property](https://swagger.io/docs/specification/2-0/paths-and-operations/) will be added
Expand Down
8 changes: 4 additions & 4 deletions core/dto.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ However, it's sometimes useful to use a specific class to represent the input or
For a given resource class, you may want to have a different representation of this class as input (write) or output (read).
To do so, a resource can take an input and/or an output class:

[codeSelector]
<code-selector>

```php
<?php
Expand Down Expand Up @@ -52,7 +52,7 @@ resources:
</resources>
```

[/codeSelector]
</code-selector>

The `input` attribute is used during [the deserialization process](serialization.md), when transforming the user-provided data to a resource instance.
Similarly, the `output` attribute is used during [the serialization process](serialization.md). This class represents how the `Book` resource will be represented in the `Response`.
Expand Down Expand Up @@ -357,7 +357,7 @@ will be skipped. If `output` is `false`, the serialization process will be skipp

`input` and `output` attributes can be set on a per operation basis:

[codeSelector]
<code-selector>

```php
<?php
Expand Down Expand Up @@ -434,7 +434,7 @@ resources:
</resources>
```

[/codeSelector]
</code-selector>

## Input/Output Metadata

Expand Down
4 changes: 2 additions & 2 deletions core/extending-jsonld-context.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ Note that you do not have to provide the `@id` attribute. If you do not provide

It's also possible to replace the Hydra context used by the documentation generator:

[codeSelector]
<code-selector>

```php
<?php
Expand Down Expand Up @@ -115,4 +115,4 @@ App\Entity\Book:
</resources>
```

[/codeSelector]
</code-selector>
Loading

0 comments on commit bc6bbab

Please sign in to comment.