choices;
$saved = json_decode($this->value());
foreach($components as $name=>$label){
$continue = false;
if(!empty($saved)):
foreach($saved as $s){
if($name == $s->name){
$continue = true;
}
}
if($continue == true)
continue;
endif;
$output .= $this->get_sortable_markup( $name, $label);
}
return $output;
}
// the actual list items in teh sortable areas
private function get_sortable_markup( $name, $label) {
$output = '';
$output .= '
';
$output .= '';
$output .= esc_html($label);
$output .= ' ';
$output .= ' ';
return $output;
}
// get the active components
private function get_active(){
$output = '';
$components = $this->choices;
$saved = json_decode($this->value());
if(empty($saved))
return $output;
foreach($saved as $component){
$name = $component->name;
$label = $component->label
? $component->label
: ucwords(str_replace('-',' ',$component->name));
$output .= $this->get_sortable_markup( $name, $label );
}
return $output;
}
private function get_available(){
$output = '';
$output .= $this->calculate_available();
return $output;
}
private function sortable_list_markup($title = null, $target = null) {
$method = 'get_'.$title;
$output = '';
$output .= '';
$output .= '
';
$output .= ucfirst($title);
$output .= ' ';
$output .= '
id.'" ';
$output .= 'data-setting="'.$this->setting->id.'"';
$output .= '>';
$output .= call_user_func(array($this, $method));
$output .= ' ';
$output .= '
';
return $output;
}
/**
* Render the content on the theme customizer page
*/
public function render_content()
{
$target = str_replace('_sortables_control', '', $this->id);
?>
label ); ?>
description; //WPCS: xss ok.?>
sortable_list_markup( __('active', 'benjamin'), $target); //WPCS: xss ok. ?>
optional):
echo $this->sortable_list_markup( __('available', 'benjamin'), $target); //WPCS: xss ok.
endif;
?>
link(); ?>
data-customize-setting-link="id); ?>"
value='value());?>'
/>