I've been doing some work in Magento 2 and have been overwriting some modules i've installed ( on the frontend ).
However today i've just come across something that I've not encountered before. The module I've been using has a block inside of it which has the following:
<referenceBlock name="product.info.details">
<block class="Vender\Module\Block\Catalog\Related" name="posts.tab" as="blog.posts"
template="Vender_Module::catalog/posts.phtml" group="detailed_info">
</block>
</referenceBlock>
It sets its name:
posts.tab
and then uses the as to allow it to be called via:
as="blog.posts"
When i tried to reference the block to be removed using the as name I noticed that it wasn't removing it from the page:
<referenceBlock name="product.info.details">
<referenceBlock as="blog.posts" remove="true"/>
</referenceBlock>
so i went to see what the page actually called in on the frontend ( just incase it was being renamed somewhere else or wasn't using the posts.tab name ) - the block name is being called in with posts.tab , which is fine as i can just reference that block to remove it. That worked fine.
But my question is, why isn't the block being pulled through using as and instead being pulled through using the name.
Secondly what is the point in the as, because obviously blocks can't have conflicting names anyway and should be unique - but i might be totally wrong.