",
$this->getID(),
$this->getID(),
esc_attr( $values )
);
$this->echoOptionFooter( false );
}
/**
* Cleans up the serialized value before saving
*
* @param string $value The serialized value
* @return string The cleaned value
* @since 1.4
*/
public function cleanValueForSaving( $value ) {
return stripslashes( $value );
}
/**
* Cleans the raw value for getting
*
* @param string $value The raw value
* @return string The cleaned value
* @since 1.4
*/
public function cleanValueForGetting( $value ) {
if ( is_array( $value ) ) {
return $value;
}
if ( is_serialized( stripslashes( $value ) ) ) {
return unserialize( $value );
}
return $value;
}
/**
* Registers the theme customizer control, for displaying the option
*
* @param WP_Customize $wp_enqueue_script The customize object
* @param TitanFrameworkCustomizerSection $section The section where this option will be placed
* @param int $priority The order of this control in the section
* @return void
* @since 1.4
*/
public function registerCustomizerControl( $wp_customize, $section, $priority = 1 ) {
$wp_customize->add_control( new TitanFrameworkOptionSortableControl( $wp_customize, $this->getID(), array(
'label' => $this->settings['name'],
'section' => $section->settings['id'],
'settings' => $this->getID(),
'description' => $this->settings['desc'],
'priority' => $priority,
'options' => $this->settings['options'],
'visible_button' => $this->settings['visible_button'],
) ) );
}
}
/*
* We create a new control for the theme customizer
*/
add_action( 'customize_register', 'registerTitanFrameworkOptionSortableControl', 1 );
/**
* Creates the option for the theme customizer
*
* @return void
* @since 1.4
*/
function registerTitanFrameworkOptionSortableControl() {
class TitanFrameworkOptionSortableControl extends WP_Customize_Control {
public $description;
public $options;
public $visible_button;
public function render_content() {
TitanFrameworkOptionSortable::createSortableScript();
if ( ! is_array( $this->options ) ) {
return;
}
if ( ! count( $this->options ) ) {
return;
}
?>
{$this->description}";
}
}
}