Walker_Comment::start_el()publicWP 2.7.0

Starts the element output.

Метод класса: Walker_Comment{}

Хуков нет.

Возвращает

null. Ничего (null).

Использование

$Walker_Comment = new Walker_Comment();
$Walker_Comment->start_el( $output, $data_object, $depth, $args, $current_object_id );
$output(строка) (обязательный) (передается по ссылке — &)
Used to append additional content. Passed by reference.
$data_object(WP_Comment) (обязательный)
Comment data object.
$depth(int)
Depth of the current comment in reference to parents.
$args(массив)
An array of arguments.
По умолчанию: empty array
$current_object_id(int)
ID of the current comment.

Заметки

Список изменений

С версии 2.7.0 Введена.
С версии 5.9.0 Renamed $comment to $data_object and $id to $current_object_id to match parent class for PHP 8 named parameter support.

Код Walker_Comment::start_el() WP 6.5.2

public function start_el( &$output, $data_object, $depth = 0, $args = array(), $current_object_id = 0 ) {
	// Restores the more descriptive, specific name for use within this method.
	$comment = $data_object;

	++$depth;
	$GLOBALS['comment_depth'] = $depth;
	$GLOBALS['comment']       = $comment;

	if ( ! empty( $args['callback'] ) ) {
		ob_start();
		call_user_func( $args['callback'], $comment, $args, $depth );
		$output .= ob_get_clean();
		return;
	}

	if ( 'comment' === $comment->comment_type ) {
		add_filter( 'comment_text', array( $this, 'filter_comment_text' ), 40, 2 );
	}

	if ( ( 'pingback' === $comment->comment_type || 'trackback' === $comment->comment_type ) && $args['short_ping'] ) {
		ob_start();
		$this->ping( $comment, $depth, $args );
		$output .= ob_get_clean();
	} elseif ( 'html5' === $args['format'] ) {
		ob_start();
		$this->html5_comment( $comment, $depth, $args );
		$output .= ob_get_clean();
	} else {
		ob_start();
		$this->comment( $comment, $depth, $args );
		$output .= ob_get_clean();
	}

	if ( 'comment' === $comment->comment_type ) {
		remove_filter( 'comment_text', array( $this, 'filter_comment_text' ), 40 );
	}
}