What exactly is the "as" attribute in <container> for in a layout xml?
When do I need to reference this one contrary to "name"?

<container name="sidebar.additional" as="sidebar_additional" label="Sidebar Additional"/>

1 Answer 1


The name attribute is unique and will serve to merge layouts together.

The as is a short way for the same block, has to be unique in context, and can serve to get the block.

For exemple (in \Magento\Framework\View\Element\AbstractBlock::getChildBlock) :


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.