Add media_view_settings and media_view_strings hooks. fixes #21092 for 3.5. see #21390.

git-svn-id: http://core.svn.wordpress.org/trunk@22702 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Nacin 2012-11-20 02:58:33 +00:00
parent 38b7b820aa
commit 3ac8cab666

View File

@ -1328,13 +1328,13 @@ function wp_enqueue_media( $args = array() ) {
), admin_url('media-upload.php') ),
);
if ( isset( $args['post'] ) )
$settings['postId'] = get_post( $args['post'] )->ID;
wp_localize_script( 'media-views', '_wpMediaViewsL10n', array(
// Settings
'settings' => $settings,
$post = null;
if ( isset( $args['post'] ) ) {
$post = get_post( $args['post'] );
$settings['postId'] = $post->ID;
}
$strings = array(
// Generic
'url' => __( 'URL' ),
'insertMedia' => __( 'Insert Media' ),
@ -1369,7 +1369,14 @@ function wp_enqueue_media( $args = array() ) {
'updateGallery' => __( 'Update gallery' ),
'continueEditing' => __( 'Continue editing' ),
'addToGallery' => __( 'Add to gallery' ),
) );
);
$settings = apply_filters( 'media_view_settings', $settings, $post );
$strings = apply_filters( 'media_view_strings', $strings, $post );
$strings['settings'] = $settings;
wp_localize_script( 'media-views', '_wpMediaViewsL10n', $strings );
wp_enqueue_script( 'media-upload' );
wp_enqueue_style( 'media-views' );