first commit
This commit is contained in:
+39
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
/**
|
||||
* Multiple Select control class.
|
||||
*
|
||||
* @package OceanWP WordPress theme
|
||||
* @subpackage Controls
|
||||
* @see https://github.com/justintadlock/butterbean
|
||||
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
*/
|
||||
|
||||
/**
|
||||
* Multiple Select control class.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
*/
|
||||
class OceanWP_ButterBean_Control_Multiple_Select extends ButterBean_Control {
|
||||
|
||||
/**
|
||||
* The type of control.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
* @var string
|
||||
*/
|
||||
public $type = 'multiple-select';
|
||||
|
||||
/**
|
||||
* Adds custom data to the json array. This data is passed to the Underscore template.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function to_json() {
|
||||
parent::to_json();
|
||||
$this->json['value'] = (array) $this->get_value();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<div class="oceanwp-mb-desc">
|
||||
<# if ( data.label ) { #>
|
||||
<span class="butterbean-label">{{ data.label }}</span>
|
||||
<# } #>
|
||||
|
||||
<# if ( data.description ) { #>
|
||||
<span class="butterbean-description">{{{ data.description }}}</span>
|
||||
<# } #>
|
||||
</div>
|
||||
|
||||
<div class="oceanwp-mb-field">
|
||||
<select class="widefat butterbean-multiple-select" multiple="multiple" name="{{ data.field_name }}[]" {{{ data.attr }}}>
|
||||
|
||||
<# _.each( data.choices, function( label, choice ) { #>
|
||||
|
||||
<option value="{{ choice }}" <# if ( ( -1 !== _.indexOf( data.value, choice ) ) ) { #> selected="selected" <# } #>>{{ label }}</option>
|
||||
|
||||
<# } ) #>
|
||||
|
||||
</select>
|
||||
</div>
|
||||
Reference in New Issue
Block a user