2

Magento 2.0.2

File :- vendor/magento/module-catalog/view/frontend/layout/catalog_product_view.xml

block :-

<block class="Magento\Catalog\Block\Product\View\Attributes" name="product.attributes" as="additional" template="product/view/attributes.phtml" group="detailed_info">
  <arguments>
     <argument translate="true" name="title" xsi:type="string">
        More Information
     </argument>
  </arguments>
</block>

I am overwriting this block in my module with same file name like this (by action method) and it is working:-

<referenceBlock name="product.attributes">
    <action method="setTitle">
       <argument name="title" xsi:type="string">Product Details</argument>
    </action>
</referenceBlock>

But when i updated this title by this below method (argument menthod) it is not working:-

<referenceBlock name="product.attributes">
    <arguments>
       <argument name="title" xsi:type="string">Product Details</argument>
    </arguments>
</referenceBlock>

So, my question here is that why it is working by first method, as it is mentioned in documentation that it is not a recommended way to modify block arguments link

0

Argument method working something like this

<referenceBlock class="Magento\Catalog\Block\Product\View\Attributes" name="product.attributes" as="additional" template="product/view/attributes.phtml" group="detailed_info">
    <arguments>
        <argument name="title" xsi:type="string">Product Details</argument>
    </arguments>
</referenceBlock>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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