After digging through the media modal code, I came up with the answer to my question:
wp.media.controller.Custom = wp.media.controller.State.extend({
initialize: function(){
this.props = new Backbone.Model();
},
// called when the toolbar button is clicked
customAction: function( controller ){
// get the value of a media view template form field using
// this.props.get('key'), where 'key' is the value of its
// 'data-setting' attribute
console.log('width: ' + this.props.get('width'));
console.log('height: ' + this.props.get('height'));
}
});
Related Posts:
- Show only images and videos in a wp.media window
- Open media frame and select an attachment
- Customizing the 3.5 “Add Media” popup (Backbone.js)
- Switch to the library tab in the media uploader
- What type of template are WP media-modal’s templates?
- Restrict file types in the uploader of a wp.media frame
- Only displaying zip files with wp media
- Insert HTML markup to page content from the Media Frame modal
- Display attachments by ID in a wp.media frame
- Custom “Uploads” Dir: “Edit Image” in Media Library broken
- Refresh wp.media after ajax call
- Filter medias from the Media Uploader (wp.media) modal with a post meta
- Rest API invalid nonce with Backbone Client
- Sending custom data with Media Frame Model
- window.send_to_editor throws unterminated string literal error when adding image with multi line description
- Uppload image from another source wp.media
- Multiple media uploader buttons target only one input on the same page
- Setting/unsetting terms using the Backbone JavaScript client
- Modal working only on home page
- Is there a media_upload_tabs-similar filter to add tabs to the simple/featured image picker?
- How to open the add media dialogue it in a certain state / tab?
- Building a Featured Gallery component for Gutenberg
- How to render WP Rest-API Endpoints in a React.js Theme with Woocommerce
- Check if user can in javascript
- wp-api Backbone JS Client fetch options
- Access checks with custom REST endpoints and backbone
- Is there any halfway decent documentation on the wp.media JS class?
- Why is this script not working?
- Error – Uncaught TypeError: e.dispatchEvent is not a function
- Use add_action to run a script, but only on the post editor page
- How To Include JS Script with WP 2023 Theme
- Update js file on wordpress page after making changes
- How to detect if we are in the Site Editor part of the Block Editor (as opposed to editing a Page/Post) in JavaScript?
- How can I show a Slot/Fill in the block editor
- How to securely set dynamic HTML content with JavaScript?
- Is it possible to add javascript to template parts
- Styling parent based on a child element of a child in a WordPress page
- How to add a new attribute to core wp block editor without npm?
- How to Update a variable even if the web page reloads in js
- Astra Mobile Cart Drawer is blank on home page
- How to add more elements to an already existing section in Gutenberg
- How do i get an Inline style in Gutenberg Block show up in front end?
- WordPress adds and tags into HTML blocks after saving
- javscript that updates div in a single wordpress page
- How do i fix type error
- I have custom html mixed with inline javascript that I want added to my WordPress site, how do I achieve this?
- CCF7 Field numbuer prefilled after Click event
- How to update the input[type=number] quantity field using custom buttons?
- Get Comment Text via REST API
- Gutenberg core/file add style support in js/ json
- uploading image to wordpress site with javascript fetch function failed
- Sending GravityForms to custom HTML
- How can I look at/edit what’s being sent to post.php when I hit the publish/update button?
- Why isn’t my SVG path rotating on scroll on iPhones?
- Access jQuery tabs from primary menu while adding/removing class on tab container elements (accessing diff. tabs/tab content via primary menu items)
- Working with a non-React external library in a custom block
- Using a form to pass GET parameters and create an array of posts accordingly
- Create Youtube embed block with createBlock
- How can I access custom data fetched from posts in a javascript script?
- Processing javascript on wordpress
- How to add a css class to postTitleWrapper in Gutenberg?
- Masonry gallery block is working in the block editor but not the template editor
- How to change the selected Template using javascript?
- How to import the imagesLoaded and Masonry libs that come with WP in a Gutenberg block?
- How do I expose the current logged in users name/etc to javascript?
- Is there an existing method to store a large set of states (900+ flags/numbers) for a single form page that it can persist for several days?
- Escaping inline JS correctly
- add_attachment hook not firing on certain devices
- Why is my JS not working on initial load?
- Additional CSS classes not being added in Gutenberg editor
- allow multi carousel in same page
- How do I filter/modify the updated content on save using javascript?
- Need help understanding Minimize main-thread work
- TypeError when editing new page or post
- How to show custom fields in modal in category page
- config @wordpress/scripts with webpack and postCSS features
- Jest Unit tests for High order component containing Block Editor
- Add div on query loop page change
- Utilizing Node.js for Server-Side Rendering for API Services in WordPress blogposts
- Embedded data and the _fields parameter in getEntityRecords
- Script tags stripped when using presto video player in WP Courses single lesson page
- Does wp i18n CLI has a prototype of “update-json” file?
- Include Block Variation Within InnerBlocks
- I need to optimize a website and I want it to import the js libraries only when I need themL
- REST API not returning all tags – is there a way to return all tags even ones that are not part of published posts?
- Force-update the meta variable first set using `var [ meta, setMeta = useEntityProp( ‘postType’, postType, ‘meta’ );`
- What’s the best way using vanilla js to force confirmation on publish button?
- WordPress REST API and Backbone JS
- Extend backbone for add new custom Rest Api
- How to execute some javascript code in the editor when a block pattern is added?
- How to build BOTH non-block components and blocks present in the /src directory using @wordpress/scripts
- How to add an additional dependency to a block index.asset.php file
- Why is the Gutenberg editor not recognizing my updates?
- How to use Javascript to get data from a WordPress form
- How to transform a shortcode into a block
- Metabox conditionals depending on post format and template in Gutenberg
- How to re-render Gutenberg component when object instance is available
- useSelect() plus resolver result is serving cached data incorrectly
- enqueue_custom_scripts isn’t working
- How to access current discussion settings in gutenberg via JS?