[wp-trac] [WordPress Trac] #29056: Media Grid: Support media_row_actions

WordPress Trac noreply at wordpress.org
Sun Sep 28 09:03:03 UTC 2014


#29056: Media Grid: Support media_row_actions
-------------------------------------+-------------------------------------
 Reporter:  pavelevap                |       Owner:
     Type:  defect (bug)             |      Status:  closed
 Priority:  low                      |   Milestone:
Component:  Media                    |     Version:  4.0
 Severity:  normal                   |  Resolution:  wontfix
 Keywords:  dev-feedback 2nd-        |     Focuses:  ui, javascript,
  opinion                            |  administration
-------------------------------------+-------------------------------------

Comment (by galeroy):

 Please disregard my previous questions.  Thanks/sorry. I was able to
 figure it out.

 Replying to [comment:10 swift]:
 > I did manage to get it working, see below. Basically you have to create
 a "form field" but the set the `'input' = 'html'` and put whatever HTML
 code you want into the `html` value.
 >
 > It works, but I agree, it would make more sense to have an action filter
 here - that also avoids having to worry about the `show_in_edit` flag.
 >
 > Good luck
 >
 > {{{
 >       public function addMediaModalAction($form_fields, $post) {
 >               $form_fields["my_action"] = array(
 >                 'label' => __(""),
 >                 'input' => "html",
 >                 'html' => '<a class="thickbox button" title="Do
 Something" href="' . admin_url( 'admin-ajax.php' ) . '?action=my_action">'
 . __('Label','plugin') . '</a>',
 >                 'show_in_edit' => false,
 >               );
 >               return $form_fields;
 >       }
 >
 >       add_action( 'attachment_fields_to_edit', array($this,
 'addMediaModalAction'), 10, 2 );
 > }}}
 > Replying to [comment:9 helgatheviking]:
 > > There are actions in place inside the modal:
 > >
 > > >"View attachment page | Edit more details | Delete Permanently"
 > >
 > > I don't understand why it is a crazy idea to be able to add another?
 Maybe they aren't "row" actions any more, but they are still actions to be
 performed on the current attachment.
 > >
 > > >"View attachment page | Edit more details | Delete Permanently | Add
 Guacamole"
 > >
 > > They appear to be coming from media-template.php (please correct me if
 I am wrong) and that already has at least one `apply_filters()` in it, so
 why can't the attachment actions be run through a filter too?
 > >
 > > `attachment_fields_to_edit` doesn't seem to be applicable to the modal
 either and the fields all seem hard-coded. @swift if you've figured out
 how to add actions/fields to the modal, would you mind sharing?
 > >

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


More information about the wp-trac mailing list