Skip to content

Conversation

@mnocon
Copy link
Contributor

@mnocon mnocon commented Dec 2, 2025

This PR fixes the wrong file includes in different files of the doc (after I've broken them when upgrading the code to v5).

Preview Reference (4.6)
docs/administration/back_office/back_office_menus/back_office_menus.md docs/administration/back_office/back_office_menus/back_office_menus.md
docs/administration/back_office/back_office_tabs/back_office_tabs.md docs/administration/back_office/back_office_tabs/back_office_tabs.md
docs/administration/back_office/customize_calendar.md docs/administration/back_office/customize_calendar.md
docs/administration/recent_activity/recent_activity.md docs/administration/recent_activity/recent_activity.md
docs/api/php_api/php_api.md docs/api/php_api/php_api.md
docs/content_management/content_api/browsing_content.md docs/content_management/content_api/browsing_content.md
docs/content_management/content_api/creating_content.md docs/content_management/content_api/creating_content.md
docs/content_management/content_management_api/bookmark_api.md docs/content_management/content_management_api/bookmark_api.md
docs/content_management/content_management_api/object_state_api.md docs/content_management/content_management_api/object_state_api.md
docs/content_management/content_management_api/section_api.md docs/content_management/content_management_api/section_api.md
docs/content_management/field_types/create_custom_generic_field_type.md docs/content_management/field_types/create_custom_generic_field_type.md
docs/content_management/taxonomy/taxonomy_api.md docs/content_management/taxonomy/taxonomy_api.md
docs/content_management/url_management/url_api.md docs/content_management/url_management/url_api.md
docs/content_management/workflow/workflow_api.md docs/content_management/workflow/workflow_api.md
docs/pim/product_api.md docs/pim/product_api.md
docs/search/search_api.md docs/search/search_api.md
docs/templating/queries_and_controllers/controllers.md docs/templating/queries_and_controllers/controllers.md
docs/tutorials/generic_field_type/6_settings.md docs/tutorials/generic_field_type/6_settings.md
docs/tutorials/generic_field_type/7_add_a_validation.md docs/tutorials/generic_field_type/7_add_a_validation.md
docs/users/segment_api.md docs/users/segment_api.md

@mnocon mnocon marked this pull request as ready for review December 3, 2025 09:22
@mnocon mnocon requested a review from a team December 3, 2025 09:22
@ibexa-workflow-automation-1 ibexa-workflow-automation-1 bot requested review from adriendupuis, dabrt and julitafalcondusza and removed request for a team December 3, 2025 09:22
Copy link
Contributor

@adriendupuis adriendupuis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Few highlight offsets and unneeded new lines.

Few $output->writeln are not really necessary and narrow the example to CLI, but some are really important to fastly illustrate properties and/or looping; could be debated.

@mnocon
Copy link
Contributor Author

mnocon commented Dec 4, 2025

@adriendupuis suggestions applied in 933f2e3

Then manual changes in 010022f and 6ce757c

Thank you for your review!

@mnocon mnocon requested a review from adriendupuis December 4, 2025 12:37
@github-actions
Copy link

github-actions bot commented Dec 4, 2025

code_samples/ change report

Before (on target branch)After (in current PR)

code_samples/api/rest_api/src/Rest/ValueObjectVisitor/Greeting.php

docs/api/rest_api/extending_rest_api/creating_new_rest_resource.md@92:``` php
docs/api/rest_api/extending_rest_api/creating_new_rest_resource.md@93:[[= include_file('code_samples/api/rest_api/src/Rest/ValueObjectVisitor/Greeting.php') =]]
docs/api/rest_api/extending_rest_api/creating_new_rest_resource.md@94:```

001⫶<?php declare(strict_types=1);
002⫶
003⫶namespace App\Rest\ValueObjectVisitor;
004⫶
005⫶use Ibexa\Contracts\Rest\Output\Generator;
006⫶use Ibexa\Contracts\Rest\Output\ValueObjectVisitor;
007⫶use Ibexa\Contracts\Rest\Output\Visitor;
008⫶
009⫶class Greeting extends ValueObjectVisitor
010⫶{
011⫶ /**
012⫶ * @param \App\Rest\Values\Greeting $data
013⫶ */

code_samples/api/rest_api/src/Rest/ValueObjectVisitor/Greeting.php

docs/api/rest_api/extending_rest_api/creating_new_rest_resource.md@92:``` php
docs/api/rest_api/extending_rest_api/creating_new_rest_resource.md@93:[[= include_file('code_samples/api/rest_api/src/Rest/ValueObjectVisitor/Greeting.php') =]]
docs/api/rest_api/extending_rest_api/creating_new_rest_resource.md@94:```

001⫶<?php declare(strict_types=1);
002⫶
003⫶namespace App\Rest\ValueObjectVisitor;
004⫶
005⫶use Ibexa\Contracts\Rest\Output\Generator;
006⫶use Ibexa\Contracts\Rest\Output\ValueObjectVisitor;
007⫶use Ibexa\Contracts\Rest\Output\Visitor;
008⫶
009⫶class Greeting extends ValueObjectVisitor
010⫶{
011⫶ /**
012⫶ * @param \App\Rest\Values\Greeting $data
013⫶ */
014⫶    public function visit(Visitor $visitor, Generator $generator, $data)
014⫶    public function visit(Visitor $visitor, Generator $generator, $data): void
015⫶    {
016⫶ $visitor->setHeader('Content-Type', $generator->getMediaType('Greeting'));
017⫶ $generator->startObjectElement('Greeting');
018⫶ $generator->attribute('href', $this->router->generate('app.rest.greeting'));
019⫶ $generator->valueElement('Salutation', $data->salutation);
020⫶ $generator->valueElement('Recipient', $data->recipient);
021⫶ $generator->valueElement('Sentence', "{$data->salutation} {$data->recipient}");
022⫶ $generator->endObjectElement('Greeting');
023⫶ }
024⫶}


code_samples/back_office/thumbnails/src/Strategy/StaticThumbnailStrategy.php

docs/administration/back_office/back_office_elements/extending_thumbnails.md@44:```php
docs/administration/back_office/back_office_elements/extending_thumbnails.md@45:[[= include_file('code_samples/back_office/thumbnails/src/Strategy/StaticThumbnailStrategy.php') =]]
docs/administration/back_office/back_office_elements/extending_thumbnails.md@46:```

001⫶<?php
002⫶
003⫶declare(strict_types=1);
004⫶
005⫶namespace App\Strategy;
006⫶
007⫶use Ibexa\Contracts\Core\Repository\Strategy\ContentThumbnail\ThumbnailStrategy;
008⫶use Ibexa\Contracts\Core\Repository\Values\Content\Thumbnail;
009⫶use Ibexa\Contracts\Core\Repository\Values\Content\VersionInfo;
010⫶use Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType;
011⫶
012⫶final readonly class StaticThumbnailStrategy implements ThumbnailStrategy
013⫶{
014⫶ public function __construct(private string $staticThumbnail)
015⫶ {
016⫶ }
017⫶
015⫶    {
016⫶ $visitor->setHeader('Content-Type', $generator->getMediaType('Greeting'));
017⫶ $generator->startObjectElement('Greeting');
018⫶ $generator->attribute('href', $this->router->generate('app.rest.greeting'));
019⫶ $generator->valueElement('Salutation', $data->salutation);
020⫶ $generator->valueElement('Recipient', $data->recipient);
021⫶ $generator->valueElement('Sentence', "{$data->salutation} {$data->recipient}");
022⫶ $generator->endObjectElement('Greeting');
023⫶ }
024⫶}


code_samples/back_office/thumbnails/src/Strategy/StaticThumbnailStrategy.php

docs/administration/back_office/back_office_elements/extending_thumbnails.md@44:```php
docs/administration/back_office/back_office_elements/extending_thumbnails.md@45:[[= include_file('code_samples/back_office/thumbnails/src/Strategy/StaticThumbnailStrategy.php') =]]
docs/administration/back_office/back_office_elements/extending_thumbnails.md@46:```

001⫶<?php
002⫶
003⫶declare(strict_types=1);
004⫶
005⫶namespace App\Strategy;
006⫶
007⫶use Ibexa\Contracts\Core\Repository\Strategy\ContentThumbnail\ThumbnailStrategy;
008⫶use Ibexa\Contracts\Core\Repository\Values\Content\Thumbnail;
009⫶use Ibexa\Contracts\Core\Repository\Values\Content\VersionInfo;
010⫶use Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType;
011⫶
012⫶final readonly class StaticThumbnailStrategy implements ThumbnailStrategy
013⫶{
014⫶ public function __construct(private string $staticThumbnail)
015⫶ {
016⫶ }
017⫶
018⫶    public function getThumbnail(ContentType $contentType, array $fields, ?VersionInfo $versionInfo = null): ?Thumbnail
018⫶    public function getThumbnail(ContentType $contentType, array $fields, ?VersionInfo $versionInfo = null): Thumbnail
019⫶    {
020⫶ return new Thumbnail([
021⫶ 'resource' => $this->staticThumbnail,
022⫶ ]);
023⫶ }
024⫶}

019⫶    {
020⫶ return new Thumbnail([
021⫶ 'resource' => $this->staticThumbnail,
022⫶ ]);
023⫶ }
024⫶}

Download colorized diff

@mnocon mnocon merged commit 82603b9 into 5.0 Dec 4, 2025
8 checks passed
@mnocon mnocon deleted the fix-code-sample-usage branch December 4, 2025 14:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants