visibility_settings = $args['visibility_settings'] ? $args['visibility_settings'] : false;
parent::__construct( $manager, $id, $args );
}
private function calculate_available() {
$output = '';
$components = $this->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 .= $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;
}
/**
* Render the content on the theme customizer page
*/
public function render_content()
{
$target = str_replace('_sortables_control', '', $this->id);
?>
description; ?>
Available
get_available(); ?>
link(); ?>
data-customize-setting-link="id; ?>"
value='value();?>'
/>