[wp-trac] [WordPress Trac] #16031: Bulk actions: Reactivate bulk actions hook + add hander hook for all admin screens

WordPress Trac noreply at wordpress.org
Thu Oct 13 18:00:24 UTC 2016


#16031: Bulk actions: Reactivate bulk actions hook + add hander hook for all admin
screens
----------------------------+------------------------
 Reporter:  Veraxus         |       Owner:  ericlewis
     Type:  enhancement     |      Status:  assigned
 Priority:  normal          |   Milestone:  4.7
Component:  Administration  |     Version:  3.1
 Severity:  normal          |  Resolution:
 Keywords:  needs-patch     |     Focuses:
----------------------------+------------------------

Comment (by Veraxus):

 Replying to [comment:94 johnbillion]:
 > The dynamically-named `handle_bulk_actions-*` hook receives different
 parameters depending on the value of the dynamic portion of the hook name.
 Yikes! Clear documentation for this will get ugly.

 I'm not entire sure I follow, but I think there's a misunderstanding about
 the patch.

 The hook accepts the following arguments...

 1. First argument is always the redirect URL (string).
 1. Second argument is always the name of the action (string).
 1. Third argument is always the array of items (array).
 1. Fourth argument applies to network screens only, but is the site id
 (int)

 If you're looking at the patches, you might have noticed that the names of
 the variables being fed to the hook vary from screen to screen, which may
 be where this misunderstanding comes from. This is because core is not
 following any sort of standard naming conventions (or even standard
 pattern) across screens.

 However, the ''data'' that each argument receives is the same, no matter
 what.

 Personally, I think it's good as-is, but some alternative options include:

 * Refactor the admin screens to standardize variable naming conventions
   * Note: Refactoring previously vetoed as out of scope for this ticket.
 * Separate the network-targetted hooks into
 `handle_network_bulk_actions-*` solely because those hooks get the site id
 as an extra argument (unnecessary, IMO).

 If your concern is with the PhpDocs having disparate variable names, the
 first option is the only solid option IMO... since proxying data into
 another variable just for the sake of the docs seems like incurring more
 tech debt on screens that already have quite a bit of that (see: disparate
 naming conventions and patterns).

--
Ticket URL: <https://core.trac.wordpress.org/ticket/16031#comment:98>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list