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


Description Description

See also See also


Top ↑

Parameters Parameters

$output

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

$object

(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)


Top ↑

Source Source

File: includes/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";
	}

Top ↑

Changelog Changelog

Changelog
Version Description
2.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.