Magento 2 – Understanding ‘at_call’ in Layout File

layoutmagento2

I often see "at_call" in the tag of a layout like below, what is this for? what it functions as? Thank you.

<block class="Magento\Catalog\Block\Product\View\Description" name="product.info.sku" template="product/view/attribute.phtml" after="product.info.type">
    <arguments>
        <argument name="at_call" xsi:type="string">getSku</argument>
        <argument name="at_code" xsi:type="string">sku</argument>
        <argument name="css_class" xsi:type="string">sku</argument>
        <argument name="at_label" xsi:type="string">default</argument>
        <argument name="add_attribute" xsi:type="string">itemprop="sku"</argument>
    </arguments>
</block>

Best Answer

it is used in the template to determine the function call to get the attribute. I think this is short for attribute_call

Here is the location in the template: https://github.com/magento/magento2/blob/develop/app/code/Magento/Catalog/view/frontend/templates/product/view/attribute.phtml#L18

The arguments from the layout are inserted into the data array of the Block. The getAtCall() Method in the template is internally translated to getData('at_call') which then retrieves the value from the layout file.

Related Topic