Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
In building a bundle management UI for Fieldable Panels Panes (#1618308: User interface for managing bundles), I discovered a few places in the export-ui that could use some touch-ups. This is particularly in reference to the ctools_export_ui_process() function and ctools_export_ui() class:
- More array unions in defining $plugin['menu']['items']. This will allow developers to make subtle updates, such as just changing the 'type' of a menu item without having to define the entire menu item. This can certainly also be done by overriding the hook_menu() method, but then those modifications will be unknown to the plugin definition and will not be reference-able later.
- Array union in defining $plugin['redirect']. Currently, I cannot define new redirects or customize redirects because the export-ui process callback will clobber them.
- Define redirect paths for delete/revert. To stay consistent and avoiding hard-coded assumptions.
- Move the build of "allowed operation" links into its own method. This makes it easy to modify the "operation" links rendered, as well as cleans up the logic for removing inapplicable links.
- Move the deletion of exportable items into its own method. This makes it possible to do post-deletion processes by overriding the method. This also uses the redirect() method, instead of hard-coding a drupal_goto().
Comment | File | Size | Author |
---|---|---|---|
#3 | improved-export-ui-1618264-3.patch | 18.94 KB | helior |
#1 | improved-export-ui-1618264-1.patch | 19 KB | helior |
Comments
Comment #1
helior CreditAttribution: helior commentedComment #2
BTMash CreditAttribution: BTMash commentedI think the changes are quite nice. Below are a few nitpicks for consistency.
You might be ok with just stating 'Deletes exportable items from the database'. I don't think stating when you should override this method.
Should be 'Builds the operation links for a specific exportable item.'
Also, talking with you, there is an advanced help file for export ui. Since you are providing two new class functions, you might want to document some of the changes in there?
Comment #3
helior CreditAttribution: helior commentedPatch is updated to accommodate for the nitpicks ;)
I took a look at the advanced help doc for export-ui. It was really intended to provide example code for a basic export ui plugin definition, and not to document class methods – it refers to reading the source file for that. Besides, this patch only has conservative updates that doesn't change the API, only makes it slightly more flexible.
Comment #4
merlinofchaos CreditAttribution: merlinofchaos commentedTagging for VDC because we need to resolve this before we start converting export ui to D8 plugins and Configurables.
Comment #5
merlinofchaos CreditAttribution: merlinofchaos commentedCommitted and pushed in both 7.x and 8.x branches.
Comment #6
merlinofchaos CreditAttribution: merlinofchaos commentedComment #7.0
(not verified) CreditAttribution: commentedUpdated issue summary.