widget_cssclass = 'blogmarks_heading_widget'; $this->widget_description = __( 'Displays widget heading style to match the theme styles. It helps if you\'re using blocks in widgets but want a heading style of the theme.', 'blogmarks' ); $this->widget_id = 'blogmarks_heading_widget'; $this->widget_name = __( 'Blogmarks: Heading', 'blogmarks' ); $this->settings = array( 'title' => array( 'type' => 'text', 'label' => __( 'Title', 'blogmarks' ), ), 'subtitle' => array( 'type' => 'text', 'label' => __( 'Subtitle', 'blogmarks' ), ), 'heading_style' => array( 'type' => 'select', 'label' => __( 'Heading Style', 'blogmarks' ), 'options' => blogmarks_get_title_styles(), 'std' => 'style_1', ), 'heading_alignment' => array( 'type' => 'select', 'label' => __( 'Heading Alignment', 'blogmarks' ), 'options' => blogmarks_get_title_alignments(), 'std' => 'left', ), 'inverted_text_color' => array( 'type' => 'checkbox', 'label' => __( 'Inverted Text Color', 'blogmarks' ), 'desc' => __( 'Can be used if you have dark background and want lighter color on the text.', 'blogmarks' ), 'std' => false, ), ); parent::__construct(); } /** * Output widget. * * @see WP_Widget * * @param array $args * @param array $instance */ public function widget( $args, $instance ) { ob_start(); $before_widget = $args['before_widget']; $after_widget = $args['after_widget']; $heading_style = isset( $instance['heading_style'] ) ? $instance['heading_style'] : $this->settings['heading_style']['std']; $heading_alignment = isset( $instance['heading_alignment'] ) ? $instance['heading_alignment'] : $this->settings['heading_alignment']['std']; $wrapper_class = 'site-section-header ' . $heading_style; $wrapper_class .= ' site-section-title-align-' . $heading_alignment; $subtitle = isset( $instance['subtitle'] ) ? $instance['subtitle'] : ''; $inverted_text_color = isset( $instance['inverted_text_color'] ) ? $instance['inverted_text_color'] : $this->settings['inverted_text_color']['std']; if ( $inverted_text_color ) { $wrapper_class .= ' blogmarks-inverted-title-color'; } echo wp_kses_post( $before_widget ); if ( $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base ) ) { ?>