Yoast_Form::hidden
Create a hidden input field.
Метод класса: Yoast_Form{}
Хуков нет.
Возвращает
null. Ничего (null).
Использование
$Yoast_Form = new Yoast_Form(); $Yoast_Form->hidden( $variable, $id, $val );
- $variable(строка) (обязательный)
- The variable within the option to create the hidden input for.
- $id(строка)
- The ID of the element.
По умолчанию:'' - $val(разное)
- The value to set in the input field. Otherwise the value from the options will be used.
По умолчанию:null
Список изменений
| С версии 2.0 | Введена. |
Код Yoast_Form::hidden() Yoast Form::hidden Yoast 27.8
public function hidden( $variable, $id = '', $val = null ) {
$val ??= $this->get_field_value( $variable, '' );
if ( is_bool( $val ) ) {
$val = ( $val === true ) ? 'true' : 'false';
}
if ( $id === '' ) {
$id = 'hidden_' . $variable;
}
echo '<input type="hidden" id="' . esc_attr( $id ) . '" name="' . esc_attr( $this->option_name . '[' . $variable . ']' ), '" value="' . esc_attr( $val ) . '"/>';
}