Skip to content

Describe brand context in developer doc - #3494

Draft
dabrt wants to merge 13 commits into
6.0from
brand-context
Draft

dabrt wants to merge 13 commits into
6.0from
brand-context

Conversation

@dabrt

@dabrt dabrt commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor
Question Answer
JIRA Ticket IBX-11537
Versions 6.0
Edition n/a

Describe brand context in developer doc

Checklist

  • Text renders correctly
  • Text has been checked with vale
  • Description metadata is up to date
  • Redirects cover removed/moved pages
  • Code samples are working

@github-actions

Copy link
Copy Markdown

code_samples/ change report

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

code_samples/brand_context/src/Command/BrandContextAiGuidelinesCommand.php


code_samples/brand_context/src/Command/BrandContextAiGuidelinesCommand.php

docs/multisite/brand_context/brand_context_api.md@112:``` php
docs/multisite/brand_context/brand_context_api.md@113:[[= include_code('code_samples/brand_context/src/Command/BrandContextAiGuidelinesCommand.php', 27, 32, remove_indent=True) =]]
docs/multisite/brand_context/brand_context_api.md@114:```

001⫶ OutputInterface $output
002⫶): int {
003⫶ // Get the AI guidelines of the brand context that the carotella_pro website belongs to
004⫶ $aiContext = $this->aiContextResolver->resolveForSiteAccess('carotella_pro', 'eng-GB');
005⫶
006⫶ foreach ($aiContext?->getEntries() ?? [] as $entry) {

docs/multisite/brand_context/brand_context_api.md@121:``` php
docs/multisite/brand_context/brand_context_api.md@122:[[= include_code('code_samples/brand_context/src/Command/BrandContextAiGuidelinesCommand.php', 34, 38, remove_indent=True) =]]
docs/multisite/brand_context/brand_context_api.md@123:```

001⫶}
002⫶
003⫶// Run code as if the carotella_pro website was selected in the back office
004⫶$aiContext = $this->siteContextService->runInContext(
005⫶ 'carotella_pro',


code_samples/brand_context/src/Command/ManageBrandContextCommand.php


code_samples/brand_context/src/Command/ManageBrandContextCommand.php

docs/multisite/brand_context/brand_context_api.md@22:``` php hl_lines="11"
docs/multisite/brand_context/brand_context_api.md@23:[[= include_code('code_samples/brand_context/src/Command/ManageBrandContextCommand.php', 37, 47, remove_indent=True) =]]
docs/multisite/brand_context/brand_context_api.md@24:```

001⫶);
002⫶
003⫶// Create a brand context
004⫶$createStruct = $this->brandContextService->newBrandContextCreateStruct('carotella');
005⫶$createStruct->setName('eng-GB', 'Carotella');
006⫶$createStruct->setDescription('eng-GB', 'Organic vegetable products for home cooks and professional kitchens');
007⫶$createStruct->setLogo('ezcontent://57');
008⫶$createStruct->setColor('#E8730C');
009⫶$createStruct->setRegion('Europe');
010⫶$createStruct->setAttributeValue('tagline', 'Fresh from the field', 'eng-GB');
011❇️$createStruct->setAttributeValue('persona_definition', 'A friendly farmer who knows good food', 'eng-GB');

docs/multisite/brand_context/brand_context_api.md@38:``` php
docs/multisite/brand_context/brand_context_api.md@39:[[= include_code('code_samples/brand_context/src/Command/ManageBrandContextCommand.php', 49, 53, remove_indent=True) =]]
docs/multisite/brand_context/brand_context_api.md@40:```

001⫶$brandContext = $this->brandContextService->createBrandContext($createStruct);
002⫶
003⫶// Assign websites to the brand context
004⫶$this->assignmentService->setAssignments($brandContext->getId(), [
005⫶ new AssignmentCreateStruct('carotella'),

docs/multisite/brand_context/brand_context_api.md@47:``` php
docs/multisite/brand_context/brand_context_api.md@48:[[= include_code('code_samples/brand_context/src/Command/ManageBrandContextCommand.php', 75, 79, remove_indent=True) =]]
docs/multisite/brand_context/brand_context_api.md@49:```

001⫶$output->writeln($brandContext->getAttributeValue('tagline', 'eng-GB')?->getValue());
002⫶
003⫶// Get the brand context of a website
004⫶$assignment = $this->assignmentService->resolveContextForSiteAccess('carotella_pro');
005⫶if ($assignment !== null) {

docs/multisite/brand_context/brand_context_api.md@55:``` php
docs/multisite/brand_context/brand_context_api.md@56:[[= include_code('code_samples/brand_context/src/Command/ManageBrandContextCommand.php', 55, 59, remove_indent=True) =]]
docs/multisite/brand_context/brand_context_api.md@57:```

001⫶]);
002⫶
003⫶// Update the brand context
004⫶$updateStruct = $this->brandContextService->newBrandContextUpdateStruct($brandContext);
005⫶$updateStruct->setAttributeValue('tagline', 'Fresh from our fields', 'eng-GB');

docs/multisite/brand_context/brand_context_api.md@67:``` php
docs/multisite/brand_context/brand_context_api.md@68:[[= include_code('code_samples/brand_context/src/Command/ManageBrandContextCommand.php', 70, 73, remove_indent=True) =]]
docs/multisite/brand_context/brand_context_api.md@69:```

001⫶}
002⫶
003⫶// Get a brand context and its attribute values
004⫶$brandContext = $this->brandContextService->getBrandContext('carotella', ['eng-GB']);

docs/multisite/brand_context/brand_context_api.md@73:``` php
docs/multisite/brand_context/brand_context_api.md@74:[[= include_code('code_samples/brand_context/src/Command/ManageBrandContextCommand.php', 61, 68, remove_indent=True) =]]
docs/multisite/brand_context/brand_context_api.md@75:```

001⫶$brandContext = $this->brandContextService->updateBrandContext($brandContext, $updateStruct);
002⫶
003⫶// Find brand contexts
004⫶$brandContexts = $this->brandContextService->findBrandContexts(
005⫶ new BrandContextQuery(new NameCriterion('Caro'), 0, 10)
006⫶);
007⫶
008⫶foreach ($brandContexts as $foundBrandContext) {


code_samples/brand_context/src/EventSubscriber/AccentColorAttributeRenderSubscriber.php


code_samples/brand_context/src/EventSubscriber/AccentColorAttributeRenderSubscriber.php

docs/multisite/brand_context/configure_brand_context.md@112:``` php hl_lines="11 17"
docs/multisite/brand_context/configure_brand_context.md@113:[[= include_file('code_samples/brand_context/src/EventSubscriber/AccentColorAttributeRenderSubscriber.php') =]]
docs/multisite/brand_context/configure_brand_context.md@114:```

001⫶<?php declare(strict_types=1);
002⫶
003⫶namespace App\EventSubscriber;
004⫶
005⫶use Ibexa\Contracts\SiteContext\Event\BrandContextAttributeRenderEvent;
006⫶use Symfony\Component\EventDispatcher\Attribute\AsEventListener;
007⫶
008⫶final readonly class AccentColorAttributeRenderSubscriber
009⫶{
010⫶ #[AsEventListener]
011❇️ public function onAttributeRender(BrandContextAttributeRenderEvent $event): void
012⫶ {
013⫶ if ($event->getAttributeValue()->getDefinition()->getIdentifier() !== 'color_accent') {
014⫶ return;
015⫶ }
016⫶
017❇️ $event->prependTemplate('@ibexadesign/brand_context/accent_color_blocks.html.twig');
018⫶ }
019⫶}


code_samples/brand_context/templates/themes/admin/brand_context/accent_color_blocks.html.twig


code_samples/brand_context/templates/themes/admin/brand_context/accent_color_blocks.html.twig

docs/multisite/brand_context/configure_brand_context.md@118:``` html+twig
docs/multisite/brand_context/configure_brand_context.md@119:[[= include_file('code_samples/brand_context/templates/themes/admin/brand_context/accent_color_blocks.html.twig') =]]
docs/multisite/brand_context/configure_brand_context.md@120:```

001⫶{% block color_attribute %}
002⫶ <span style="display: inline-block; width: 1em; height: 1em; background-color: {{ value }};"></span>
003⫶ <strong>{{ value }}</strong>
004⫶{% endblock %}


code_samples/data_migration/examples/brand_context/attribute_definition_delete.yaml


code_samples/data_migration/examples/brand_context/attribute_definition_delete.yaml

docs/content_management/data_migration/importing_data.md@697:``` yaml
docs/content_management/data_migration/importing_data.md@698:[[= include_file('code_samples/data_migration/examples/brand_context/attribute_definition_delete.yaml') =]]
docs/content_management/data_migration/importing_data.md@699:```

001⫶-
002⫶ type: brand_context_attribute_definition
003⫶ mode: delete
004⫶ criteria:
005⫶ type: field_value
006⫶ field: identifier
007⫶ value: social_tiktok
008⫶ operator: '='


code_samples/data_migration/examples/brand_context/attribute_definition_update.yaml


code_samples/data_migration/examples/brand_context/attribute_definition_update.yaml

docs/content_management/data_migration/importing_data.md@691:``` yaml
docs/content_management/data_migration/importing_data.md@692:[[= include_file('code_samples/data_migration/examples/brand_context/attribute_definition_update.yaml') =]]
docs/content_management/data_migration/importing_data.md@693:```

001⫶-
002⫶ type: brand_context_attribute_definition
003⫶ mode: update
004⫶ criteria:
005⫶ type: field_value
006⫶ field: identifier
007⫶ value: certifications
008⫶ operator: '='
009⫶ position: 20
010⫶ descriptions:
011⫶ eng-GB: Environmental and fair trade certifications held by the brand


code_samples/data_migration/examples/brand_context/attribute_group_definition_create.yaml


code_samples/data_migration/examples/brand_context/attribute_group_definition_create.yaml

docs/content_management/data_migration/importing_data.md@684:``` yaml
docs/content_management/data_migration/importing_data.md@685:[[= include_file('code_samples/data_migration/examples/brand_context/attribute_group_definition_create.yaml') =]]
docs/content_management/data_migration/importing_data.md@686:```

001⫶-
002⫶ type: brand_context_attribute_group
003⫶ mode: create
004⫶ identifier: sustainability
005⫶ labels:
006⫶ eng-GB: Sustainability
007⫶
008⫶-
009⫶ type: brand_context_attribute_definition
010⫶ mode: create
011⫶ identifier: certifications
012⫶ attribute_group_identifier: sustainability
013⫶ type_identifier: text
014⫶ position: 10
015⫶ required: false
016⫶ translatable: true
017⫶ descriptions:
018⫶ eng-GB: Environmental certifications held by the brand
019⫶
020⫶-
021⫶ type: brand_context_attribute_definition
022⫶ mode: create
023⫶ identifier: preferred_terms
024⫶ attribute_group_identifier: ai_context
025⫶ type_identifier: text
026⫶ position: 70
027⫶ required: false
028⫶ translatable: true
029⫶ descriptions:
030⫶ eng-GB: Terms to use when describing products

Download colorized diff

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant