acf_get_checkbox_input() ACF 5.0.0
Returns the HTML of a checkbox input.
Хуков нет.
Возвращает
Строку.
Использование
acf_get_checkbox_input( $attrs );
- $attrs(массив)
- The array of attrs.
Список изменений
С версии 5.0.0 | Введена. |
Код acf_get_checkbox_input() acf get checkbox input ACF 5.9.1
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_attr($attrs) . '/> ' . acf_esc_html($label) . '</label>';
}