2

I need to find the template or layout file that contains this ul tag:

<ul class="header links">
    <li class="greet welcome" data-bind="scope: 'customer'">
        <!-- ko if: customer().fullname  -->
        <span data-bind="text: new String('Benvenuto, %1!').replace('%1', customer().firstname)">
        </span>
        <!-- /ko -->
        <!-- ko ifnot: customer().fullname  -->
        <span data-bind="html:'Testo di benvenuto predefinito!'"></span>
        <!-- /ko -->
    </li>
<li class="authorization-link" data-label="o">
    <a href="https://mysiteurl/index.php/customer/account/login/">
        Login    </a>
</li>

<li><a href="https://mysiteurl/index.php/customer/account/create/" >Create an account</a></li></ul>

I need only the <ul> tag. Where and how to find it?

1
  • If my answer is useful to you then accept an answer, so it will be useful to another user. Thanks Commented Jun 13, 2019 at 8:27

2 Answers 2

0

You can check it from customer default layout file.

Magento/Customer/view/frontend/layout/default.xml

0

You can't find <ul class="header links"> tag in whole magento directory you can find <li class="greet welcome"> in below path :

vendor/magento/module-theme/view/frontend/templates/html/header.phtml

Actually <ul> tags comes from the vendor/magento/module-theme/view/frontend/layout/default.xml below is code.

<block class="Magento\Customer\Block\Account\Navigation" name="top.links">
          <arguments>
              <argument name="css_class" xsi:type="string">header links</argument>
          </arguments>
 </block>

Using above XML magento create HTML tag in container. below is the list of the allowed tag.

protected $allowedTags = [
   'aside',
   'dd',
   'div',
   'dl',
   'fieldset',
   'main',
   'nav',
   'header',
   'footer',
   'ol',
   'p',
   'section',
   'table',
   'tfoot',
   'ul',
];

You will see it in class Magento\Framework\View\Layout\Container.

And here, Magento render a container to HTML. You can rewrite it <ul> tag (I have no idea how to rewrite or change tag) Magento/Framework/View/Layout.php

protected function _renderContainer($name)
{
    $html = '';
    $children = $this->getChildNames($name);
    foreach ($children as $child) {
        $html .= $this->renderElement($child);
    }
    if ($html == '' || !$this->structure->getAttribute($name, Element::CONTAINER_OPT_HTML_TAG)) {
        return $html;
    }
    $htmlId = $this->structure->getAttribute($name, Element::CONTAINER_OPT_HTML_ID);
    if ($htmlId) {
        $htmlId = ' id="' . $htmlId . '"';
    }
    $htmlClass = $this->structure->getAttribute($name, Element::CONTAINER_OPT_HTML_CLASS);
    if ($htmlClass) {
        $htmlClass = ' class="' . $htmlClass . '"';
    }
    $htmlTag = $this->structure->getAttribute($name, Element::CONTAINER_OPT_HTML_TAG);
    $html = sprintf('<%1$s%2$s%3$s>%4$s</%1$s>', $htmlTag, $htmlId, $htmlClass, $html);
    return $html;
}

I hope it helps to solve out your issue!

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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