From a5f62a6cd59deabaf0b8fe5468ed7c82b6f309e6 Mon Sep 17 00:00:00 2001 From: Scott Taylor Date: Fri, 18 Sep 2015 19:59:43 +0000 Subject: [PATCH] Media: add a filter, `'mejs_settings'`, to allow devs to pass more config settings to MediaElement. Fixes #33506. git-svn-id: https://develop.svn.wordpress.org/trunk@34311 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/script-loader.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/wp-includes/script-loader.php b/src/wp-includes/script-loader.php index a3a1a5690e..26a3f8cab7 100644 --- a/src/wp-includes/script-loader.php +++ b/src/wp-includes/script-loader.php @@ -351,9 +351,19 @@ function wp_default_scripts( &$scripts ) { $scripts->add( 'wp-mediaelement', "/wp-includes/js/mediaelement/wp-mediaelement.js", array('mediaelement'), false, 1 ); - did_action( 'init' ) && $scripts->localize( 'mediaelement', '_wpmejsSettings', array( + $mejs_settings = array( 'pluginPath' => includes_url( 'js/mediaelement/', 'relative' ), - ) ); + ); + did_action( 'init' ) && $scripts->localize( 'mediaelement', '_wpmejsSettings', + /** + * Filter the MediaElement configuration settings. + * + * @since 4.4.0 + * + * @param array $mejs_settings MediaElement settings array. + */ + apply_filters( 'mejs_settings', $mejs_settings ) + ); $scripts->add( 'froogaloop', "/wp-includes/js/mediaelement/froogaloop.min.js", array(), '2.0' ); $scripts->add( 'wp-playlist', "/wp-includes/js/mediaelement/wp-playlist.js", array( 'wp-util', 'backbone', 'mediaelement' ), false, 1 );