' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped break; default: break; } } /** * Register widget display posts entry classes. * * @param str $classes Comma separated entry posts classes. * @param array $instance Settings for the current widget instance. * @return str Entry posts classes. */ public function entry_classes( $classes, $instance ) { if ( 'tribe_events' === get_post_type() ) { $classes[] = 'dp-event no-zig'; } return $classes; } /** * Add items to widget title area. * * @param array $after_title Items before closing of widget title. * @param array $instance Settings for the current widget instance. * @return str */ public function dp_wid_title( $after_title, $instance ) { $link_html = ''; // Change only if theme specific after_title args has not been altered. if ( '' !== $after_title ) { return $after_title; } if ( 'tribe_events' === $instance['post_type'] ) { $link_html = sprintf( '%2$s %3$s', esc_url( tribe_get_events_link() ), esc_html__( 'Calendar', 'bayleaf' ), bayleaf_get_icon( array( 'icon' => 'long-arrow-right' ) ) ); } return '' . $link_html . ''; } /** * Get array of all widget options. * * @since 1.0.0 * * @param array $options Array of widget options. */ public function widget_options( $options ) { return array_merge( $options, [ 'bayleaf_widget_featured_image' => [ 'setting' => 'bayleaf_widget_featured_image', 'label' => esc_html__( 'Widget Featured Image', 'bayleaf' ), 'type' => 'image_upload', 'id_base' => [ 'mc4wp_form_widget', 'mo_optin_widgets' ], ], ] ); } /** * Display featured image before mc4wp widget (if any). * * @since 1.0.0 * * @param str $markup Widget customized content markup. * @param array $widget_data { * Current widget's data to generate customized output. * @type str $widget_id Widget ID. * @type int $widget_pos Widget position in widgetlayer widget-area. * @type array $instance Current widget instance settings. * @type str $id_base Widget ID base. * } * @return string Widget customized content markup. */ public function display_widget_image( $markup, $widget_data ) { $instance = $widget_data[2]; $id_base = $widget_data[3]; $widget_img = false; if ( 'mc4wp_form_widget' === $id_base && isset( $instance['bayleaf_widget_featured_image'] ) ) { $widget_img = true; } if ( 'mo_optin_widgets' === $id_base && isset( $instance['bayleaf_widget_featured_image'] ) ) { $widget_img = true; } // Generate markup for text widget featured image. if ( true === $widget_img ) { $image_id = absint( $instance['bayleaf_widget_featured_image'] ); if ( $image_id ) { $classes = []; $image_size = apply_filters( 'bayleaf_widget_image_size', 'bayleaf-large', $widget_data ); $classes[] = 'widget-bg-featured-image'; $classes = apply_filters( 'bayleaf_widget_image_classes', $classes, $widget_data ); $img_markup = wp_get_attachment_image( $image_id, $image_size, false, [ 'class' => join( ' ', $classes ) ] ); $markup = sprintf( '
%s
', $img_markup ); } } return $markup; } /** * Markup after text widget (if any). * * @since 1.0.0 * * @param str $markup Widget customized content markup. * @param array $widget_data { * Current widget's data to generate customized output. * @type str $widget_id Widget ID. * @type int $widget_pos Widget position in widgetlayer widget-area. * @type array $instance Current widget instance settings. * @type str $id_base Widget ID base. * } * @return string Widget customized content markup. */ public function widget_wrapper_close( $markup, $widget_data ) { $instance = $widget_data[2]; $id_base = $widget_data[3]; $widget_img = false; if ( 'mc4wp_form_widget' === $id_base && isset( $instance['bayleaf_widget_featured_image'] ) ) { $widget_img = true; } if ( 'mo_optin_widgets' === $id_base && isset( $instance['bayleaf_widget_featured_image'] ) ) { $widget_img = true; } // Generate markup for text widget featured image. if ( true === $widget_img ) { $image_id = absint( $instance['bayleaf_widget_featured_image'] ); if ( $image_id ) { $markup = '
'; } } return $markup; } /** * Submit theme default options for simplified font manager. * * @return array Array of theme default font options. */ public function font_options() { return array( array( 'family' => array( 'montserrat', 'Montserrat', 'goo-sans-serif', 'Montserrat', ), 'weights' => array( '400', '400italic', '700', '700italic' ), 'selectors' => 'body', ), array( 'family' => array( 'poppins', 'Poppins', 'goo-serif', 'Poppins', ), 'weights' => array( '400', '600', '700', '400italic', '700italic' ), 'selectors' => 'h1,h2,h3,h4,h5,h6,.site-title', ), ); } } Plugins_Compat::init();