SubPage Menu Widget should Default to Current Page

Description

When inserting a SubPage menu widget in to a page, a slug field is provided, however it is empty. When left empty , it generates a full site menu.

The use case for this widget would be relative to the current page. As such, when opening this widget form, it should default to the current page, rather than requiring the user to close the form and re-open to retrieve the page slug.

Activity

Show:

Jon Clausen July 27, 2021 at 4:36 PM

If you look at the widget code generation, page is always passed as an empty string if it is not provided. As such, what the SubPage widget actually delivers without that argument is a full site submenu.

Default inserted widget with no config:

That said, I’m not entirely sure why it doesn’t throw a null error on the the if ( isSimpleValue( arguments.page ) ) { conditional when it tries to retrieve it from ORM and gets a null back for findBySlug( '' )

My suggestion would be to change the conditional to

 

Luis Majano July 27, 2021 at 3:48 PM
Edited

This is actually the way it works . However, when doing an inline preview, it won’t show it that way, because the page is detected at runtime in the actual UI module. YOu can see the code here for the subpage menu where it detects the current page:

 

So when the widget executes in the context of the UI module, and no page is passed, it will use the current page. The preview is deceiving because it grabs the root.

Fixed
Pinned fields
Click on the next to a field label to start pinning.

Details

Assignee

Reporter

Fix versions

Priority

Sentry

Created July 27, 2021 at 1:39 PM
Updated September 4, 2021 at 4:03 PM
Resolved September 4, 2021 at 4:03 PM