ACF_Taxonomy_Field_Walker::start_el()
Start the element output.
Метод класса: ACF_Taxonomy_Field_Walker{}
Хуков нет.
Возвращает
null
. Ничего.
Использование
$ACF_Taxonomy_Field_Walker = new ACF_Taxonomy_Field_Walker(); $ACF_Taxonomy_Field_Walker->start_el( $output, $term, $depth, $args, $id );
- $output(строка) (обязательный) (передается по ссылке — &)
- Used to append additional content (passed by reference).
- $term(WP_Term) (обязательный)
- The current term object.
- $depth(int)
- Depth of the term in reference to parents.
- $args(массив)
- An array of arguments. @see wp_terms_checklist()
По умолчанию: array() - $id(int)
- ID of the current term.
Заметки
- Смотрите: Walker::start_el()
Список изменений
С версии 1.0.0 | Введена. |
Код ACF_Taxonomy_Field_Walker::start_el() ACF Taxonomy Field Walker::start el ACF 6.0.4
public function start_el( &$output, $term, $depth = 0, $args = array(), $id = 0 ) { $is_selected = in_array( $term->term_id, $this->field['value'] ); // Generate array of checkbox input attributes. $input_attrs = array( 'type' => $this->field['field_type'], 'name' => $this->field['name'], 'value' => $term->term_id, ); if ( $is_selected ) { $input_attrs['checked'] = true; } $output .= "\n" . '<li data-id="' . esc_attr( $term->term_id ) . '">' . '<label' . ( $is_selected ? ' class="selected"' : '' ) . '>' . '<input ' . acf_esc_attrs( $input_attrs ) . '/> ' . '<span>' . acf_esc_html( $term->name ) . '</span>' . '</label>'; }