BBP_Walker_Dropdown::start_el( string $output,  $object, int $depth, array $args = array(), int $current_object_id )

Description

See also

Parameters

$output

(Required) Passed by reference. Used to append additional content.

$_post

(Required) Post data object.

$depth

(Required) Depth of post in reference to parent posts. Used for padding.

$args

(Optional) Uses 'selected' argument for selected post to set selected HTML attribute for option element.

Default value: array()

$current_object_id

(Required)

Source

File: bp-forums/common/classes.php

	public function start_el( &$output, $object, $depth = 0, $args = array(), $current_object_id = 0 ) {
		$pad     = str_repeat( ' ', (int) $depth * 3 );
		$output .= '<option class="level-' . (int) $depth . '"';

		// Disable the <option> if:
		// - we're told to do so
		// - the post type is a forum
		// - the forum is a category
		// - forum is closed
		if (	( true === $args['disable_categories'] )
				&& ( bbp_get_forum_post_type() === $object->post_type )
				&& ( bbp_is_forum_category( $object->ID )
					|| ( !current_user_can( 'edit_forum', $object->ID ) && bbp_is_forum_closed( $object->ID )
				)
			) ) {
			$output .= ' disabled="disabled" value=""';
		} else {
			$output .= ' value="' . (int) $object->ID .'"' . selected( $args['selected'], $object->ID, false );
		}

		$output .= '>';
		$title   = apply_filters( 'bbp_walker_dropdown_post_title', $object->post_title, $output, $object, $depth, $args );
		$output .= $pad . esc_html( $title );
		$output .= "</option>\n";
	}

Changelog

Changelog
Version Description
bbPress (r2746) 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.