-
Notifications
You must be signed in to change notification settings - Fork 10
EntityDev
The default layout is smile_custom_entity_set_view
. If you want a custom view for your entity set, you can use a smile_custom_entity_set_view_type_{entity set name}
layout for change global entity type display.
For example: If you have a Brand
entity type, you can create a layout smile_custom_entity_set_view_type_brand.xml
.
If you want change entity display in entity set, it's possible to use smile_custom_entity_entity_renderers
layout and append your custom entity renderer. Add a renderer with an alias that is set to the name of the entity type.
For example, In my Example_MyModule
:
- you have a
Brand
entity type - create a layout
view/frontend/layout/smile_custom_entity_entity_renderers.xml
- Add inside
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceBlock name="custom_entity.set.entity.renderers">
<block class="Smile\CustomEntity\Block\Set\Entity\Renderer" name="custom_entity.set.entity.renderers.brand" as="brand" template="Example_MyModule::set/entity/brand.phtml" />
</referenceBlock>
</body>
</page>
- And create
view/frontend/templates/set/entity/brand.phtml
template
Some examples that require a display change:
- display my entities like an ABC-book
- add a custom attribute in entity renderer
- ...
The same for the entities, the default layout is smile_custom_entity_entity_view.xml
. If you want change entity view, you can use a smile_custom_entity_entity_view_type_{entity set name}
layout.
For example: If you have an entity with Brand
type, you can create a layout smile_custom_entity_entity_view_type_brand.xml
.
An example that require a display change, add a custom attribute in entity page.