Magento – How to pass arguments to phtml block

blockslayoutmagento2xml

I've updated the default breadcrumbs.phtml which now displays the company logo within the breadcrumb section, however I do not need the logo to show on category pages.

I have tried to update my catalog_category_view.xml to pass an argument to the block:

<?xml version="1.0"?>
<!--
/**
 * Copyright © 2013-2017 Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */
-->
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="2columns-left" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <block class="Magento\Theme\Block\Html\Breadcrumbs" name="breadcrumbs" as="breadcrumbs"/>
            <arguments>
                <argument name="show_logo" xsi:type="boolean">false</argument>
            </arguments>
        </block>
    </body>
</page>

and within my breadcrumbs.phtml I am trying to get the value of the show_logo by:

echo $this->getData('show_logo');

Unfortunately, this isn't working?

Can anyone please help me to understand why this isn't working and how I can get this to work so that I can check the argument so I can check whether to show the logo or not?

Thanks

Best Answer

You have to use the following method instead of:

$this->getShowLogo();

If you want to know the value, use vardump() or print_r().Hope it help you!