Add a filter and document it: `playlist_styles`. Allows users to roll their own playlist themes.
Props DrewAPicture for the docs. See #26631. git-svn-id: https://develop.svn.wordpress.org/trunk@27488 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
975cf5574a
commit
c2cd0d6215
|
@ -417,17 +417,27 @@ function wp_print_media_templates() {
|
||||||
<script type="text/html" id="tmpl-playlist-settings">
|
<script type="text/html" id="tmpl-playlist-settings">
|
||||||
<h3><?php _e( 'Playlist Settings' ); ?></h3>
|
<h3><?php _e( 'Playlist Settings' ); ?></h3>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
$playlist_styles = array(
|
||||||
|
'light' => _x( 'Light', 'light playlist theme' ),
|
||||||
|
'dark' => _x( 'Dark', 'dark playlist theme' )
|
||||||
|
);
|
||||||
|
|
||||||
|
/** This filter is documented in wp-includes/media.php */
|
||||||
|
$styles = apply_filters( 'playlist_styles', $playlist_styles );
|
||||||
|
|
||||||
|
if ( ! empty( $styles ) ): ?>
|
||||||
<label class="setting">
|
<label class="setting">
|
||||||
<span><?php _e( 'Style' ); ?></span>
|
<span><?php _e( 'Style' ); ?></span>
|
||||||
<select class="style" data-setting="style">
|
<select class="style" data-setting="style">
|
||||||
<option value="light">
|
<?php foreach ( $styles as $slug => $label ): ?>
|
||||||
<?php esc_attr_e( 'Light' ); ?>
|
<option value="<?php echo esc_attr( $slug ) ?>">
|
||||||
</option>
|
<?php echo $label ?>
|
||||||
<option value="dark">
|
|
||||||
<?php esc_attr_e( 'Dark' ); ?>
|
|
||||||
</option>
|
</option>
|
||||||
|
<?php endforeach ?>
|
||||||
</select>
|
</select>
|
||||||
</label>
|
</label>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
<#
|
<#
|
||||||
var playlist = 'playlist-edit' === data.controller.id, emptyModel = _.isEmpty(data.model);
|
var playlist = 'playlist-edit' === data.controller.id, emptyModel = _.isEmpty(data.model);
|
||||||
|
|
|
@ -1123,7 +1123,21 @@ function wp_get_playlist( $attr, $type ) {
|
||||||
$orderby = 'none';
|
$orderby = 'none';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ! in_array( $style, array( 'light', 'dark' ), true ) ) {
|
$playlist_styles = array(
|
||||||
|
'light' => _x( 'Light', 'light playlist theme' ),
|
||||||
|
'dark' => _x( 'Dark', 'dark playlist theme' )
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the available playlist styles.
|
||||||
|
*
|
||||||
|
* @since 3.9.0
|
||||||
|
*
|
||||||
|
* @param array $playlist_styles Array of playlist styles. Defaults are 'light' and 'dark'.
|
||||||
|
*/
|
||||||
|
$styles = apply_filters( 'playlist_styles', $playlist_styles );
|
||||||
|
|
||||||
|
if ( ! in_array( $style, array_keys( $styles ), true ) ) {
|
||||||
$style = 'light';
|
$style = 'light';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue