start_controls_section( 'section_shape', [ 'label' => __( 'Shape', 'wts-eae' ), ] ); $this->add_control( 'separator_shape', [ 'label' => __( 'Shape', 'wts-eae' ), 'type' => Controls_Manager::SELECT, 'options' => [ 'triangle-upper-left' => __( 'Triangle Upper Left', 'wts-eae' ), 'triangle-upper-right' => __( 'Triangle Upper Right', 'wts-eae' ), 'triangle-bottom-left' => __( 'Triangle Bottom Left', 'wts-eae' ), 'triangle-bottom-right' => __( 'Triangle Bottom Right', 'wts-eae' ), ], 'default' => 'triangle-upper-right', ] ); $this->add_control( 'shape_color', [ 'label' => __( 'Shape Color', 'wts-eae' ), 'type' => Controls_Manager::COLOR, 'global' => [ 'default' => Global_Colors::COLOR_PRIMARY, ], 'selectors' => [ '{{WRAPPER}} svg' => 'fill:{{VALUE}}', ], ] ); $this->add_control( 'shape_height', [ 'type' => Controls_Manager::NUMBER, 'label' => __( 'Shape Height (in px)', 'wts-eae' ), 'placeholder' => __( '75', 'wts-eae' ), 'default' => __( '75', 'wts-eae' ), ] ); $this->end_controls_section(); } protected function render() { $settings = $this->get_settings(); // Unset when a global color is used; the fill then comes from the selector CSS. if ( ! isset( $settings['shape_color'] ) ) { $settings['shape_color'] = ''; } switch ( $settings['separator_shape'] ) { case 'triangle-upper-left': include EAE_PATH . 'modules/shape-separator/shapes/triangle-upper-left.php'; break; case 'triangle-upper-right': include EAE_PATH . 'modules/shape-separator/shapes/triangle-upper-right.php'; break; case 'triangle-bottom-left': include EAE_PATH . 'modules/shape-separator/shapes/triangle-bottom-left.php'; break; case 'triangle-bottom-right': include EAE_PATH . 'modules/shape-separator/shapes/triangle-bottom-right.php'; break; } } }