更改header.links上的“创建帐户”文字?

时间:2016-06-10 06:45:33

标签: layout magento2

想要在文本之前将“创建帐户”文本更改为“注册”图像标签,但我无法使用 Magento_Customer / layout / default.xml的以下修改更新文本

<referenceBlock name="register-link">
    <arguments>
        <argument name="label" xsi:type="string" translate="true">Register</argument>
    </arguments>
</referenceBlock>
<referenceBlock name="my-account-link" display="false" />
    <!--
    <move element="register-link" destination="header.links"/>
    <move element="header" destination="header.links" before="-"/>
    <move element="top.links" destination="customer"/>
    <move element="authorization-link" destination="top.links" after="-"/>
    -->


    <block
        class="Magento\Customer\Block\Account\AuthorizationLink" name="authorization-link"
        template="account/link/authorization.phtml" before="register-link"/>
</referenceBlock>
<block class="Magento\Theme\Block\Html\Header" name="header" as="header">
    <!--
    <arguments>
        <argument name="show_part" xsi:type="string">welcome</argument>
    </arguments>
    -->
</block> 

我的错是什么?

2 个答案:

答案 0 :(得分:4)

<referenceBlock name="register-link">
<arguments>
<argument name="label" xsi:type="string" translate="true">Register</argument></arguments>
</referenceBlock>

将代码置于/app/design/frontend/vendor/module/Magento_Theme/layout/default.xml

之上

刷新Magento缓存......

答案 1 :(得分:2)

转到 app / design / frontend / vendor / module / Magento_Theme / layout / default.xml

并放置在代码下方

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceBlock name="register-link">
            <arguments>
                <argument name="label" xsi:type="string" translate="true">Register</argument>
            </arguments>
        </referenceBlock>
    </body>
</page>