[wp-trac] [WordPress Trac] #29056: Media Grid: Support media_row_actions
WordPress Trac
noreply at wordpress.org
Sun Sep 28 08:41:32 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):
@swift - I'd like to try implementing your work-around. I'm a junior
level programmer, however, and am wondering if you'd be kind enough to
provide a few more details?
Would it be possible to explain:
+ which file your code would be placed in? ( media-template.php ?)
+ which section or line number the above code would be place in?
+ an example of the corresponding html? I'm not exactly sure how to - or
if I need to - modify this line in your example - (to correspond to my
environment):
{{{$form_fields["my_action"] = array('label' => __(""),}}}
Thanks a lot.
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:11>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list