Magento2: Can not add widget to specific Page Layouts

Created on 7 May 2017  路  10Comments  路  Source: magento/magento2

Try to add widget to specific page layouts, but in admin panel no page layouts list is empty

Preconditions

  1. Magento 2.1.6
  2. PHP 7.0.15

Steps to reproduce

  1. Magento Admin panel -> Content -> Widgets
  2. Click "Add Widget" button, then select any widget and theme.
  3. Click Add Layout Update button and then select Display on to Page Layouts

Expected result

  1. In Page dropdown, All Page Layouts should be list out.

Actual result

  1. Actual, there are no Page Layouts listed.
    widget_page_layouts
Widget Confirmed P3 ready for dev Reproduced on 2.4.x

Most helpful comment

Hello everyone! Any status update on this?

Also please note that when adding a custom cms page in magento 2.2.5 that custom cms does not get displayed in widget layout update for specified pages. Page type does not get updated at all. This should be native functionallity tbh to add widgets to any page you want even if it is a newly made CMS page without manually updating the page_types.xml in your own module.

Steps to repilcate:

  1. Create new cms page. Content -> Pages
  2. Create new widget Content -> Widget
  3. Go to layout updates
  4. Select Specified page - check the dropdown list which will not have the newly created page on it

I noticed you are manually adding types in vendor/magento/module-cms/etc/frontend/page_types.xml.

Are we missing something here?

All 10 comments

Hello, @gizmocn. Based on Your issue an internal ticket was created - MAGETWO-70278. You'll be informed after the issue is resolved. Thank's for applying.

@gizmocn, thank you for your report.
We've created internal ticket(s) MAGETWO-70278 to track progress on the issue.

I bumped into this issue as well. However, it seems that simply none of the Page Layouts (like 1column.xml) have been added to this widget selection box because of reasons. I created a sample module (as part of a training during which this was raised as a question) that demonstrates the right code: https://github.com/yireo-training/magento2-example-custom-page-layout For reference, I'm also including a question that Alan Storm raised on this, which got me on the right way: https://magento.stackexchange.com/questions/102467/what-is-a-magento-2-design-abstraction

In short, a regular layout file (layout/example.xml) always starts with a page node that could now include a label (label="My example") and a design_abstraction="page_layout". In the current system, all of the layouts mentioned under the widget selection box discussed here, have set design_abstraction="custom". By changing custom into page_layout, layouts also appear in the Page Layout option group in the selection box.

However, the terminology leads me to think something is off. It would make sense if the custom value refers to handles within the regular layout and the page_layout value refers to handles within the page layout (like 1column). Unfortunately, the whole design_abstraction attribute is not allowed to be used in a page layout file, because it is not included in its XSD. As a workaround, in my example module, I've simply included the page layout in the regular layout, which works as well.

Hello everyone! Any status update on this?

Also please note that when adding a custom cms page in magento 2.2.5 that custom cms does not get displayed in widget layout update for specified pages. Page type does not get updated at all. This should be native functionallity tbh to add widgets to any page you want even if it is a newly made CMS page without manually updating the page_types.xml in your own module.

Steps to repilcate:

  1. Create new cms page. Content -> Pages
  2. Create new widget Content -> Widget
  3. Go to layout updates
  4. Select Specified page - check the dropdown list which will not have the newly created page on it

I noticed you are manually adding types in vendor/magento/module-cms/etc/frontend/page_types.xml.

Are we missing something here?

Hi @sdzhepa. Thank you for working on this issue.
In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:

  • [ ] 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).
    DetailsIf the issue has a valid description, the label Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.
  • [ ] 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.

  • [ ] 3. Add Component: XXXXX label(s) to the ticket, indicating the components it may be related to.

  • [ ] 4. Verify that the issue is reproducible on 2.4-develop branch

    Details- Add the comment @magento give me 2.4-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.4-develop branch, please, add the label Reproduced on 2.4.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and _stop verification process here_!

  • [ ] 5. Add label Issue: Confirmed once verification is complete.

  • [ ] 6. Make sure that automatic system confirms that report has been added to the backlog.

Same issue. Subscribing for an update.

Hi @engcom-Golf. Thank you for working on this issue.
In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:

  • [ ] 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).
    DetailsIf the issue has a valid description, the label Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.
  • [ ] 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.

  • [ ] 3. Add Component: XXXXX label(s) to the ticket, indicating the components it may be related to.

  • [ ] 4. Verify that the issue is reproducible on 2.4-develop branch

    Details- Add the comment @magento give me 2.4-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.4-develop branch, please, add the label Reproduced on 2.4.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and _stop verification process here_!

  • [ ] 5. Add label Issue: Confirmed once verification is complete.

  • [ ] 6. Make sure that automatic system confirms that report has been added to the backlog.

:white_check_mark: Confirmed by @engcom-Golf
Thank you for verifying the issue. Based on the provided information internal tickets MC-31869 were created

Issue Available: @engcom-Golf, _You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself._

Hi @engcom-Kilo. Thank you for working on this issue.
Looks like this issue is already verified and confirmed. But if you want to validate it one more time, please, go though the following instruction:

  • [ ] 1. Add/Edit Component: XXXXX label(s) to the ticket, indicating the components it may be related to.
  • [ ] 2. Verify that the issue is reproducible on 2.4-develop branch

    Details- Add the comment @magento give me 2.4-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.4-develop branch, please, add the label Reproduced on 2.4.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and _stop verification process here_!

  • [ ] 3. If the issue is not relevant or is not reproducible any more, feel free to close it.


Hi everyone! Any update on this?

Was this page helpful?
0 / 5 - 0 ratings