Yoast_Form::legend()publicYoast 3.4

Output a legend element.

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

Хуков нет.

Возвращает

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

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

$Yoast_Form = new Yoast_Form();
$Yoast_Form->legend( $text, $attr );
$text(строка) (обязательный)
Legend text string.
$attr(массив) (обязательный)
HTML attributes set.

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

С версии 3.4 Введена.

Код Yoast_Form::legend() Yoast 22.4

public function legend( $text, $attr ) {
	$defaults = [
		'id'    => '',
		'class' => '',
	];
	$attr     = wp_parse_args( $attr, $defaults );

	$id = ( $attr['id'] === '' ) ? '' : ' id="' . esc_attr( $attr['id'] ) . '"';
	// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- output escaped before.
	echo '<legend class="' . esc_attr( 'yoast-form-legend ' . $attr['class'] ) . '"' . $id . '>' . $text . '</legend>';
}