-
-
Notifications
You must be signed in to change notification settings - Fork 197
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bring menu item/reference selection into core and make a new Reference selector widget #961
Comments
OH God yes. I rarely use static pages but use the static pages menu editor all the time. I'd love for it to be extensible so I can store other data such as related font icons or extend it to recognize Passage permissions. |
See https://docs.octobercms.com/3.x/element/form/widget-pagefinder.html, it has some concepts that I like. Could also be very useful for dealing with the issues of switching media sources in different environments, i.e. we could use it for the inline images / files / document links in content to make switching between environments seemless. |
Package targeted
Both
Description
I was hoping to implement this as a PR immediately, but it's become a little bigger than I had imagined so I think it's best we scope this out.
Currently, this Menu Item selector/editor is only available when the Pages plugin is installed:
However, I feel (and I seem to recall the other maintainers feeling the same) that this is a well useful tool that could be used in other areas, and as such should be brought into core. Ideally, I'd like to create a new FormWidget called "Reference" which brings up a (simplified) version of this selector and calls for all plugin references (the
pages.menuitem.*
events), allowing the user to select a reference for cross-linking, or providing an ability for a field to contain either a straight URL or a dynamic reference to a plugin item. This would make it similar to Wordpress' link picker:Storage
There's two ways we could store these references:
fileupload
widgets with Halcyon objects.Reference FormWidget
The Reference form widget should, at a minimum, provide the following fields from the menu item editor above:
It should return a class representing the reference: ideally, this class should be able to determine if there's multiple references or not, and return URLs for each.
It may be prudent to allow the form widget to be configured to accept only one reference (therefore not allowing nested items), or accept multiple.
Other places to implement this
The same picker should be made available for the Rich Editor and Markdown Editor's link buttons. Currently, I believe, these both allow you to just pick a CMS page.
Will this change be backwards-compatible?
Yes, backwards compatibility would be maintained.
Ideally, we'll need to use new event names, but call the old event names for compatibility and merge the results. I propose the following:
references.getTypes
(replacespages.menuitem.listTypes
, gets the available reference types for the "Type" dropdown)references.getReferences
(replacespages.menuitem.getTypeInfo
, gets the available references for a particular type)references.resolve
(replacespages.menuitem.resolveItem
, resolves a reference object)The text was updated successfully, but these errors were encountered: