9

I am seen that some of magento modules has page_types.xml at configuration section means ../etc/frontend section.

<page_types xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_types.xsd">
    <type id="checkout_cart_configure" label="Configure Cart Item (Any)"/>
    <type id="checkout_cart_index" label="Shopping Cart"/>
    <type id="checkout_onepage_failure" label="One Page Checkout Failure"/>
    <type id="checkout_index_index" label="One Page Checkout"/>
    <type id="checkout_onepage_paymentmethod" label="One Page Checkout Choose Payment Method"/>
    <type id="checkout_onepage_review" label="One Page Checkout Overview"/>
    <type id="checkout_onepage_shippingmethod" label="One Page Checkout Choose Shipping Method"/>
    <type id="checkout_onepage_success" label="One Page Checkout Success"/>
</page_types>

So, my question

  • Why are use this xml files?
  • If we assume that is used for declaration of each actions of that module's then if we create any custom module with out page_types.xml then those custom actions are also worked. Seems it confusing.Can anyone clear the idea of use page_types.xml
3
  • there is some information about this here , magento.stackexchange.com/a/180961/31830, may be this will help you Apr 19, 2018 at 17:48
  • Hello, Amit did you got the answer for this?
    – Shivam
    Apr 26, 2018 at 13:51
  • Not yet. ...If will have then i will post here.,May be wasim share link an answer
    – Amit Bera
    Apr 26, 2018 at 13:52

1 Answer 1

11

The page_types.xml file allows an admin to add custom content to all the controller actions defined in it. If you want to allow the admin to add custom block to your new page you can add it to the page_types.xml file.

From what I can understand the page_types are referenced in the widget area, under the Layout Updates fieldset of the Storefront Properties tab when you select the option Specified Page for the Display on.

This allows you to add additional information on the page, like a CMS block, directly from the admin area.

Let's take for example the contact form which resides in the magento-contact module. You can add a widget of type CMS Static Block, select the Contact Us Form page and the area where you want to add a block (Main Content Bottom in our example).

specified page for widget

On the Widget Options select the block that you wish to show on the contact form in the Main Content Bottom container.

widget options tab selecting block

And with this changes you have added a new block in the main bottom content of the Contact Us pages.

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.