acf_field_checkbox::render_field_custom
description
Метод класса: acf_field_checkbox{}
Хуков нет.
Возвращает
$post_id. (int)
Использование
$acf_field_checkbox = new acf_field_checkbox(); $acf_field_checkbox->render_field_custom( $field );
- $field(обязательный)
- .
Список изменений
| С версии 5.6.0 | Введена. |
Код acf_field_checkbox::render_field_custom() acf field checkbox::render field custom ACF 6.4.2
function render_field_custom( $field ) {
// vars
$html = '';
// loop
foreach ( $field['value'] as $value ) {
// ignore if already eixsts
if ( isset( $field['choices'][ $value ] ) ) {
continue;
}
// vars
$esc_value = esc_attr( $value );
$text_input = array(
'name' => $field['name'],
'value' => $value,
);
// bail early if choice already exists
if ( in_array( $esc_value, $this->_values ) ) {
continue;
}
// append
$html .= '<li><input class="acf-checkbox-custom" type="checkbox" checked="checked" />' . acf_get_text_input( $text_input ) . '</li>' . "\n";
}
// append button
$html .= '<li><a href="#" class="button acf-add-checkbox">' . esc_attr( $field['custom_choice_button_text'] ) . '</a></li>' . "\n";
// return
return $html;
}