strings = wp_parse_args( isset( $args['strings'] ) ? $args['strings'] : array(), array( 'top-left' => __( 'Top Left', 'bloghash' ), 'top' => __( 'Top', 'bloghash' ), 'top-right' => __( 'Top Right', 'bloghash' ), 'left' => __( 'Left', 'bloghash' ), 'center' => __( 'Center', 'bloghash' ), 'right' => __( 'Right', 'bloghash' ), 'bottom-left' => __( 'Bottom Left', 'bloghash' ), 'bottom' => __( 'Bottom', 'bloghash' ), 'bottom-right' => __( 'Bottom Right', 'bloghash' ), ) ); $this->icons = wp_parse_args( isset( $args['icons'] ) ? $args['icons'] : array(), array( 'top-left' => 'dashicons dashicons-arrow-left-alt', 'top' => 'dashicons dashicons-arrow-up-alt', 'top-right' => 'dashicons dashicons-arrow-right-alt', 'left' => 'dashicons dashicons-arrow-left-alt', 'center' => 'alignment-position-center-icon', 'right' => 'dashicons dashicons-arrow-right-alt', 'bottom-left' => 'dashicons dashicons-arrow-left-alt', 'bottom' => 'dashicons dashicons-arrow-down-alt', 'bottom-right' => 'dashicons dashicons-arrow-right-alt', ) ); // Alignment choices. $default_choices = array( 'top-left' => true, 'top' => true, 'top-right' => true, 'left' => true, 'center' => true, 'right' => true, 'bottom-left' => true, 'bottom' => true, 'bottom-right' => true, ); if ( isset( $args['choices'] ) ) { if ( 'horizontal' === $args['choices'] ) { $this->choices = array( 'top-left' => false, 'top' => false, 'top-right' => false, 'left' => true, 'center' => true, 'right' => true, 'bottom-left' => false, 'bottom' => false, 'bottom-right' => false, ); } elseif ( 'vertical' === $args['choices'] ) { $this->choices = array( 'top-left' => false, 'top' => true, 'top-right' => false, 'left' => false, 'center' => true, 'right' => false, 'bottom-left' => false, 'bottom' => true, 'bottom-right' => false, ); } elseif ( is_array( $args['choices'] ) ) { $this->choices = array( 'top-left' => false, 'top' => false, 'top-right' => false, 'left' => false, 'center' => false, 'right' => false, 'bottom-left' => false, 'bottom' => false, 'bottom-right' => false, ); foreach ( $args['choices'] as $choice ) { $this->choices[ $choice ] = true; } } } else { $this->choices = $default_choices; } foreach ( $this->choices as $key => $value ) { $this->choices[ $key ] = true === $value ? '' : 'disabled'; } } /** * Refresh the parameters passed to the JavaScript via JSON. * * @see WP_Customize_Control::to_json() */ public function to_json() { parent::to_json(); $this->json['choices'] = $this->choices; $this->json['l10n'] = $this->strings; $this->json['icons'] = $this->icons; } /** * An Underscore (JS) template for this control's content (but not its container). * * Class variables for this control class are available in the `data` JS object; * export custom variables by overriding {@see WP_Customize_Control::to_json()}. * * @see WP_Customize_Control::print_template() */ protected function content_template() { ?>