Home Forums Add-ons Gallery Field Interacting with the gallery fields frame


Interacting with the gallery fields frame

  • I’m looking to run a javascript when gallery images are successfully uploaded. I’ve done this for the wordpress featured image meta box using this method:

    Is there something similar I can do with the gallery meta box? If I look into acf-pro-input.js I can see that it calls the media frame

    var frame ={
    	title:		acf._e('gallery', 'select'),

    Not sure how I can interact with it though. acf._e is available in the chrome javascript console. But it does not contain .frame() or .get()..

    Any help? Not even sure if it works similar to featured images box since featured image is just one images while the gallery is multiple..

  • Hi @intelligence

    To be honest I’ve never tried to hook into anything like this..
    Have you checked what contains when setting images for the gallery field?

    Also, just out of curiosity, to what end do you need this? 🙂

  • Ah. Yes I plan on running a little script called color thief ( I will save the values generated from the script and use it for styling.

    Actually, exist, but can’t see any attachments to it, hm. exist but only links to a function in media-edtior.js:

    * @param {wp.shortcode} shortcode An instance of wp.shortcode().
    * @returns {} A Backbone.Collection containing
    * the media items belonging to a collection.
    * The query[ this.tag ] property is a Backbone.Model
    * containing the ‘props’ for the collection.

  • Ah nice. I suppose a hacky solution would be to do this on the front end instead, checking for an existing value beforehand so it’s only done once.

    Hm, I would’ve thought you’d see some attachments there.
    so does not return anything from that function? Based on that comment it seems it should’ve returned the media items.

Viewing 4 posts - 1 through 4 (of 4 total)

The topic ‘Interacting with the gallery fields frame’ is closed to new replies.