BP_Nouveau_Object_Nav_Widget::widget( mixed $args, unknown $instance )

Displays the output, the button to post new support topics

Description

Parameters

$args

(Required) Arguments

$instance

(Required)

Source

File: bp-templates/bp-nouveau/includes/classes.php

	public function widget( $args, $instance ) {
		if ( ! is_buddypress() || bp_is_group_create() ) {
			return;
		}

		/**
		 * Filters the nav widget args for the BP_Nouveau_Object_Nav_Widget widget.
		 *
		 * @since BuddyPress 3.0.0
		 *
		 * @param array $value Array of arguments {
		 *     @param bool $bp_nouveau_widget_title Whether or not to assign a title for the widget.
		 * }
		 */
		$item_nav_args = wp_parse_args( $instance, apply_filters( 'bp_nouveau_object_nav_widget_args', array(
			'bp_nouveau_widget_title' => true,
		) ) );

		$title = '';

		if ( ! empty( $item_nav_args['bp_nouveau_widget_title'] ) ) {
			if ( bp_is_group() ) {
				$title = bp_get_current_group_name();
			} elseif ( bp_is_user() ) {
				$title = bp_get_displayed_user_fullname();
			} elseif ( bp_get_directory_title( bp_current_component() ) ) {
				$title = bp_get_directory_title( bp_current_component() );
			}
		}

		/**
		 * Filters the BP_Nouveau_Object_Nav_Widget widget title.
		 *
		 * @since BuddyPress 3.0.0
		 *
		 * @param string $title    The widget title.
		 * @param array  $instance The settings for the particular instance of the widget.
		 * @param string $id_base  Root ID for all widgets of this type.
		 */
		$title = apply_filters( 'widget_title', $title, $instance, $this->id_base );

		echo $args['before_widget'];

		if ( ! empty( $title ) ) {
			echo $args['before_title'] . $title . $args['after_title'];
		}

		if ( bp_is_user() ) {
			bp_get_template_part( 'members/single/parts/item-nav' );
		} elseif ( bp_is_group() ) {
			bp_get_template_part( 'groups/single/parts/item-nav' );
		} elseif ( bp_is_directory() ) {
			bp_get_template_part( 'common/nav/directory-nav' );
		}

		echo $args['after_widget'];
	}

Changelog

Changelog
Version Description
BuddyPress 3.0.0 Introduced.

Questions?

We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.