theme_url . '/assets/admin/js/modules/customizer/controls/dimensions.js', array( 'jquery', 'customize-base' ), false, true ); wp_localize_script( 'analytica-dimensions', 'analyticaL10n', $this->l10n() ); wp_enqueue_style( 'analytica-dimensions', analytica()->theme_url . '/assets/admin/css/customizer/controls/dimensions.min.css', null ); } /** * Renders the control wrapper and calls $this->render_content() for the internals. * * @see WP_Customize_Control::render() */ protected function render() { $id = 'customize-control-' . str_replace( array( '[', ']' ), array( '-', '' ), $this->id ); $class = 'customize-control has-switchers customize-control-' . $this->type; ?>
  • render_content(); ?>
  • value(); if ( isset( $value[ $setting_key ] ) ) { return $value[ $setting_key ]; } } /** * Refresh the parameters passed to the JavaScript via JSON. * * @see WP_Customize_Control::to_json() */ public function to_json() { parent::to_json(); $this->json['id'] = $this->id; $this->json['l10n'] = $this->l10n(); $this->json['title'] = esc_html__( 'Link values together', 'analytica' ); $this->json['choices'] = $this->choices; $this->json['device'] = $this->device ? $this->device : 'desktop'; $this->json['inputAttrs'] = ''; foreach ( $this->input_attrs as $attr => $value ) { $this->json['inputAttrs'] .= $attr . '="' . esc_attr( $value ) . '" '; } foreach ( $this->choices as $control ) { $this->json[ $this->device ][ $control ] = array( 'id' => $control, 'link' => $this->get_link( $control ), 'value' => $this->get_value( $control ), ); } } /** * 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() * * @access protected */ protected function content_template() { ?> <# if ( data.label ) { #> {{{ data.label }}} <# } #> <# if ( data.description ) { #> {{{ data.description }}} <# } #> esc_attr__( 'Top', 'analytica' ), 'right' => esc_attr__( 'Right', 'analytica' ), 'bottom' => esc_attr__( 'Bottom', 'analytica' ), 'left' => esc_attr__( 'Left', 'analytica' ), ); if ( false === $id ) { return $translation_strings; } return $translation_strings[ $id ]; } } add_action( 'customize_register', 'analytica_customize_register_dimensions_controls' ); // Register control with kirki function analytica_customize_register_dimensions_controls( $wp_customize ) { $wp_customize->register_control_type( 'Kirki_Controls_Dimensions_Responsive_Control' ); } add_filter( 'kirki_control_types', 'analytica_register_dimensions_kirki_control_type' ); // Register our custom control with Kirki function analytica_register_dimensions_kirki_control_type( $controls ) { $controls['dimensions-responsive'] = 'Kirki_Controls_Dimensions_Responsive_Control'; return $controls; }