params = $args['params']; parent::__construct( $manager, $id, $args ); } private function abs_path_to_url( $path = '' ) { $url = str_replace( wp_normalize_path( untrailingslashit( ABSPATH ) ), site_url(), wp_normalize_path( $path ) ); return esc_url_raw( $url ); } public function enqueue() { wp_enqueue_script( 'color-picker', $this->abs_path_to_url( dirname( __FILE__ ).'/js/colorpicker.js'), array('jquery'), '1.0', true ); wp_enqueue_script( 'jquery-classygradient', $this->abs_path_to_url( dirname( __FILE__ ).'/js/jquery.classygradient.js'), array('jquery'), '1.0', true ); wp_enqueue_script( 'custom-gradient',$this->abs_path_to_url( dirname( __FILE__ ).'/js/custom-gradient.js'), array('jquery','jquery-ui-slider'), '1.0', true ); wp_enqueue_style( 'color-picker', $this->abs_path_to_url( dirname( __FILE__ ).'/css/colorpicker.css')); wp_enqueue_style( 'jquery-classygradient', $this->abs_path_to_url( dirname( __FILE__ ).'/css/jquery.classygradient.css')); } public function render_content() { if ( ! empty( $this->label ) ) : ?> label ); ?> description ) ) : ?> description ); ?> type; $params = $this->params; $class = isset($params['class']) ? $params['class'] : ''; $default_color = isset($params['default_color']) ? $params['default_color'] : '0% #0051FF, 100% #00C5FF'; $picker_label = isset($params['picker_label']) ? $params['picker_label'] : esc_html__("Define Gradient Colors", "bingle"); $picker_description = isset($params['picker_description']) ? $params['picker_description'] : esc_html__("For a gradient, at least one starting and one end color should be defined.", "bingle"); $angle_label = isset($params['angle_label']) ? $params['angle_label'] : esc_html__("Define Gradient Direction", "bingle"); $preview_label = isset($params['preview_label']) ? $params['preview_label'] : esc_html__("Gradient Preview", "bingle"); $html = '
'; // Classy Gradient Picker $html .= '
'; $html .= '
' . esc_html( $picker_label ) . '
'; $html .= '
'; $html .= '
' . esc_html( $picker_description ) . '
'; $html .= '
'; // Gradient Linear Direction Selector $html .= '
'; $html .= '
' . esc_html($angle_label) . '
'; $html .= ''; $html .= '
'; // Gradient Custom Angle Input $html .= '
'; $html .= ''; $html .= '
'; // Gradient Preview Panel $html .= '
'; $html .= '
' . esc_html($preview_label) . '
'; $html .= '
'; $html .= '
'; echo $html; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?> link(); ?> />