Blocks
Blocks are low-level reusable fragments under yui/blocks/*. They are meant for small, repeated rendering units that should stay consistent across pages/components.
What Belongs to Blocks
Good block candidates:
- head partials (
meta,fonts,styles,scripts) - totals row renderers
- popup shells
- shared fragments that appear in several components
Poor block candidates:
- full feature modules (use components)
- route orchestration (use pages)
- global skeleton contract (use layouts)
Main Block Groups in Plugin
_head/*: default head partials used by base layoutcart/*: cart totals and cart-specific fragmentscheckout/*: checkout totals, action rows, checkout fragmentsglobal/*: popup templates and shared global fragmentscustomer/*: account sidebar and account fragmentserrors/*: error page fragments
Real Examples
yui/blocks/_head/meta.twigyui/blocks/cart/totals/grand_total.twigyui/blocks/checkout/totals/switch.twigyui/blocks/global/popup/minicart-sidebar.twigyui/blocks/form-resources.twig
Example Usage
{% include 'yui/blocks/_head/meta.twig' %}
{% include 'yui/blocks/checkout/totals/switch.twig' %}
Developer Guidelines
- Keep blocks focused and small.
- Prefer parameterized rendering over hidden global dependencies.
- Do not couple blocks to a single page route.
- Keep translation keys and labels consistent with existing cart/checkout semantics.
- If a block starts to own business behavior, promote it to a component.