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?
- What does “javascript:void(0)” mean?
- For-each over an array in JavaScript
- require is not defined? Node.js
- What is NODE_ENV and how to use it in Express?
- JavaScript null check
- JavaScript “Uncaught TypeError: object is not a function” associativity question
- How can I get file extensions with JavaScript?
- How to detect Safari, Chrome, IE, Firefox and Opera browser?
- What does on() in JavaScript do?
- AngularJS : Factory and Service?
- What’s the difference between console.dir and console.log?
- Use images like checkboxes
- How to hide a div with jQuery?v
- How do I pass variables and data from PHP to JavaScript?
- How do I set/unset a cookie with jQuery?
- Calling onclick on a radiobutton list using javascript
- How to properly export an ES6 class in Node 4?
- Uncaught Typeerror: cannot read property ‘innerHTML’ of null
- Sorting HTML table with JavaScript
- Relation between CommonJS, AMD and RequireJS?
- How to loop through an array containing objects and access their properties
- Trying to use fetch and pass in mode: no-cors
- Moment.js transform to date object
- jQuery explode string like PHP
- Call Javascript function from URL/address bar
- Anagrams finder in javascript
- Validate date in dd/mm/yyyy format using JQuery Validate
- How to subtract days from a plain Date?
- Stopping a JavaScript function when a certain condition is met
- Showing an image from an array of images – Javascript
- Javascript isnull
- Get querystring from URL using jQuery [duplicate]
- Check if string contains only digits
- JS: iterating over result of getElementsByClassName using Array.forEach
- jQuery checkbox change and click event
- Error: listen EACCES 0.0.0.0:80 OSx Node.js
- jQuery selectors on custom data attributes using HTML5
- How to check if a value is not null and not empty string in JS
- How do I refresh a DIV content?
- TypeError: abc.getAttribute is not a function
- window.location() not working, not opening page
- How to clear the canvas for redrawing
- What’s a Good Javascript Time Picker?
- JavaScript event window.onload not triggered
- Default text on input
- JSX not allowed in files with extension ‘ .js’ with eslint-config-airbnb
- How to use wordpress default Password Strength Meter script
- Pass custom fields values to Google Maps
- Documentation for IDE’s
- Cloudflare’s Rocket Loader + WordPress -> Ignore scripts?
- What is “open()” in MediaUpload?
- What’s the handle for media.js?
- How can I add Block Style support to the core HTML block in Gutenberg?
- Use onfocus event in Contact Form 7
- a child theme not de-registering a patent javascript file
- Customizer JS API: Defining active_callback for a section
- Don’t allow JavaScript in the content area
- How to change the text of the “You are about to permanently delete these items…” alert message when deleting media from the media library?
- Using javascript on my site to create nested tabs
- CDATA removing new line in script tag in wordpress
- Get style and script file versions and use them while writing a cache manifest file
- Set a minimum and maximum limit of images to select in the MediaUpload component for Block
- Save in localstorage and db and show it later
- Load Particles.js into WordPress Website
- Proper way of minifiying java script files in wordpress theme
- None of the JavaScript works when using wp_editor
- JS enqueue path (localhost)
- Load and execute javascript from body
- WordPress Theme – jQuery JavaScript Library Issue
- Script loaders vs wp_enqueue_script
- WP REST API – “rest_user_cannot_view” ONLY on specific users
- How to add a new attribute to core wp block editor without npm?
- How to render HTML content using the Interactivity API?