Closed patrickf0 closed 10 years ago
Thanks for the report! I'll see how it can be fixed.
Same for File Selection fields...
It seems it causes the error "Uncaught TypeError: Cannot read property 'metadata' of undefined" when the button is pressed.
I don't know what causes it. Maybe the order of jQuery related files has changed or something. I haven't looked into it yet.
The link
custom field type does not cause this error so I may change it to the way like the button of the link
custom field does.
It seems it is nothing to do with how the framework handles the button press event.
After enabling SCRIPT_DEBUG
, I've found the part that causes the error in .../wp-includes/js/media-views.js
in WordPress v4.0.
The initialize()
method of the media.controller.Embed
object has changed and it seem to be the cause.
In WordPress v4.0, https://github.com/WordPress/WordPress/blob/4.0/wp-includes/js/media-views.js#L1413-L1419
initialize: function(options) {
this.metadata = options.metadata;
this.debouncedScan = _.debounce( _.bind( this.scan, this ), this.sensitivity );
this.props = new Backbone.Model( this.metadata || { url: '' });
this.props.on( 'change:url', this.debouncedScan, this );
this.props.on( 'change:url', this.refresh, this );
this.on( 'scan', this.scanImage, this );
},
In WordPress 3.9.2, https://github.com/WordPress/WordPress/blob/3.9.2/wp-includes/js/media-views.js#L1344-L1350
initialize: function() {
this.debouncedScan = _.debounce( _.bind( this.scan, this ), this.sensitivity );
this.props = new Backbone.Model({ url: '' });
this.props.on( 'change:url', this.debouncedScan, this );
this.props.on( 'change:url', this.refresh, this );
this.on( 'scan', this.scanImage, this );
},
It seems this is the part which needs to be modified: https://github.com/michaeluno/admin-page-framework/blob/3.1.5/development/_view/AdminPageFramework_FieldType/AdminPageFramework_FieldType_Base.php#L314-L363, especially the following line,
// Embed states.
new wp.media.controller.Embed(),
Updated the 3.1.6b branch: https://github.com/michaeluno/admin-page-framework/tree/3.1.6b Download. https://github.com/michaeluno/admin-page-framework/archive/3.1.6b.zip
It includes an update for another issue (https://github.com/michaeluno/admin-page-framework/issues/100) that affects the behavior of repeating form sections. So anybody using repeatable sections, please test if it does not break anything.
Hi there,
with the new WP 4.0 version the image select button is not working.
So far I do not found any other problems...