acf_get_checkbox_input()
acf_get_checkbox_input
Returns the HTML of a checkbox input.
Хуков нет.
Возвращает
Строку.
Использование
acf_get_checkbox_input( $attrs );
- $attrs(массив)
- The array of attrs.
По умолчанию:array()
Список изменений
| С версии 5.0.0 | Введена. |
Код acf_get_checkbox_input() acf get checkbox input ACF 6.4.2
function acf_get_checkbox_input( $attrs = array() ) {
// Allow radio or checkbox type.
$attrs = wp_parse_args(
$attrs,
array(
'type' => 'checkbox',
)
);
// Get label.
$label = '';
if ( isset( $attrs['label'] ) ) {
$label = $attrs['label'];
unset( $attrs['label'] );
}
// Render.
$checked = isset( $attrs['checked'] );
return '<label' . ( $checked ? ' class="selected"' : '' ) . '><input ' . acf_esc_attrs( $attrs ) . '/> ' . acf_esc_html( $label ) . '</label>';
}