I've been learning the ropes in theming in magento 2, I've started to get the hang of it with my own theme using Snowdog as my parent and styling in sass.
My question is, I came to remove the welcome message yesterday and couldn't find any xml related to this. So I went in search and found it in the header.phtml file.
<?php
/**
* Copyright © 2016 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
// @codingStandardsIgnoreFile
/**
* @var \Magento\Theme\Block\Html\Header $block
*/
$welcomeMessage = $block->getWelcome();
?>
<?php switch ($block->getShowPart()):
case 'welcome': ?>
<li class="greet welcome" data-bind="scope: 'customer'">
<!-- ko if: customer().fullname -->
<span data-bind="text: new String('<?php echo $block->escapeHtml(__('Welcome, %1!', '%1'));?>').replace('%1', customer().firstname)">
</span>
<!-- /ko -->
<!-- ko ifnot: customer().fullname -->
<span data-bind="html:'<?=$block->escapeHtml($welcomeMessage) ?>'"></span>
<!-- /ko -->
</li>
<script type="text/x-magento-init">
{
"*": {
"Magento_Ui/js/core/app": {
"components": {
"customer": {
"component": "Magento_Customer/js/view/customer"
}
}
}
}
}
</script>
<?php break; ?>
<?php case 'other': ?>
<?php echo $block->getChildHtml(); ?>
<?php break; ?>
<?php endswitch; ?>
But then i realised there isn't any other php or html inside of this file, the whole of the header is built with xml.
Why is it built with xml? Are there any benefits to this? Should I continue to use xml, or should i look at doing it with php - html?
Thanks.