Content Blocks are the foundation of your site, and they can help create a custom layout. In Oro applications, you can modify the existing content blocks, or create your own.
Creating a new content block requires developers’ assistance. As a sample, use Home Page Slider content block, the code and configuration in the yaml file that helps embed it into the website homepage.
To edit a defined content block:
Navigate to Marketing > Content Blocks in the main menu.
Click at the end of the content block you wish to edit, and click to open the selected block for editing.
In the General tab, you can amend the following fields:
- Owner — The owner of the content block.
- Alias — The unique identifier that can be used in the layout to render a block.
- Titles — Localized block title.
To enable/disable the content block, select/clear the Enabled check box.
- In the Restrictions section, you can specify or edit visibility restrictions for the content block.
By default, the content block is displayed for any localization, on any website, and for any customer. To make OroCommerce apply a content block to the storefront only for the particular combination of these facts, create a restriction by selecting all or some of the following: target localization, website, customer, or customer group.
Only one field must be chosen for customers at a time, either a customer group or a customer.
In the Content Variants section, you can add (click Add Content) or remove (click ) various content variants for the content block. Once you add more than one content variant, you will have to apply restrictions to any non-default variants. These restrictions help you set up the conditions where content should override the default option.
Never leave the restrictions for non-default variant empty. This may cause unexpected priority collision between the default and non-default variant.
Only one field must be chosen for customers at a time, either a customer group and a customer.
For instance, you can set the content block to have a specific text displayed for Non-authenticated Visitors. For that:
- Set visibility restrictions to Non-authenticated Visitors in Restrictions > Customer Groups.
- Add a new content variant by clicking Add Content in the Content Variant section.
- Enter text.
To translate the content block (e.g., the homepage slider), restrict it to the required localization(s).
For instance, to translate the homepage slider into German:
Set the visibility restriction to German in Restrictions > Localization.
Edit the default variant to include Germany-specific content, or add another content variant by clicking +Add.
Click Save and Close
Once switched to the German localization, the home page slider displays the new content.