Magento – magento2 frontend layout extending

layoutmagento2

I want to move search textbox and cart image to left side of top links.
enter image description here

For this i have created theme puma and specified parent as luma.
After customer login top links moved to dropdown. Now I want to move search textbox and cart image to left side of top links.

I have identified search textbox is coming from vendor/magento/module-search/view/frontend/templates/form.mini.phtml, and its layout default.xml in vendor/magento/module-search/ and its block name as topSearch.

so i have created Module_Search folder -> layout folder and default.xml file in app/design/frontend/puma.

And i wrote <move element="topSearch" destination="top.links" before="customer"/> but its not working.

Assume i was perfect till identifying block but i could not identify destination value, I have seen Magento_Theme->page_layout->1column.xml but could not identify.

Best Answer

I have reviwed your request Please follow below steps.

You need to create 'Search Module' folder under your puma theme and copy default.xml into layout

(e.g) puma > Magento_CatalogSearch > layout > default.xml

To move top.search you need to write following code in your (puma > Magento_CatalogSearch > layout > default.xml)

<move element="top.search" destination="header.panel" before="header.links"/>

To move minicart you need to write following code in your (puma > Magento_Checkout > layout > default.xml)

where header.panel is <referenceContainer> of header.links please review luma > Magento_Theme > layout > default.xml

<referenceContainer name="header.panel">
        <block class="Magento\Framework\View\Element\Html\Links" name="header.links">
            <arguments>
                <argument name="css_class" xsi:type="string">header links</argument>
            </arguments>
        </block>
</referenceContainer>

or you can also write directly into (puma > Magento_Theme > layout > default.xml)

<move element="top.search" destination="header.panel" before="header.links"/>
<move element="minicart" destination="header.panel" after="top.search"/>

please let me know if it's not working.