Yoast_Form::textarea()
Create a textarea.
Метод класса: Yoast_Form{}
Хуков нет.
Возвращает
null
. Ничего (null).
Использование
$Yoast_Form = new Yoast_Form(); $Yoast_Form->textarea( $variable, $label, $attr );
- $variable(строка) (обязательный)
- The variable within the option to create the textarea for.
- $label(строка) (обязательный)
- The label to show for the variable.
- $attr(строка|массив)
- The CSS class or an array of attributes to assign to the textarea.
По умолчанию: []
Список изменений
С версии 2.0 | Введена. |
Код Yoast_Form::textarea() Yoast Form::textarea Yoast 24.4
public function textarea( $variable, $label, $attr = [] ) { if ( ! is_array( $attr ) ) { $attr = [ 'class' => $attr, ]; } $defaults = [ 'cols' => '', 'rows' => '', 'class' => '', 'disabled' => false, ]; $attr = wp_parse_args( $attr, $defaults ); $val = $this->get_field_value( $variable, '' ); $this->label( $label, [ 'for' => $variable, 'class' => 'textinput', ] ); $disabled_attribute = $this->get_disabled_attribute( $variable, $attr ); // phpcs:ignore WordPress.Security.EscapeOutput -- Reason: $disabled_attribute output is hardcoded and all other output is properly escaped. echo '<textarea cols="' . esc_attr( $attr['cols'] ) . '" rows="' . esc_attr( $attr['rows'] ) . '" class="' . esc_attr( 'textinput ' . $attr['class'] ) . '" id="' . esc_attr( $variable ) . '" name="' . esc_attr( $this->option_name . '[' . $variable . ']' ), '"', $disabled_attribute, '>' . esc_textarea( $val ) . '</textarea><br class="clear" />'; }