WC_Product_Cat_Dropdown_Walker::start_el() public WC 2.1.0
Starts the list before the elements are added.
{} Это метод класса: WC_Product_Cat_Dropdown_Walker{}
Хуки из метода
Возвращает
Null. Ничего.
Использование
$WC_Product_Cat_Dropdown_Walker = new WC_Product_Cat_Dropdown_Walker(); $WC_Product_Cat_Dropdown_Walker->start_el( $output, $cat, $depth, $args, $current_object_id );
- $output(строка) (обязательный)
- Passed by reference. Used to append additional content.
- $cat(объект) (обязательный)
- Category.
- $depth(число)
- Depth of category in reference to parents.
- $args(массив)
- Arguments.
- $current_object_id(число)
- Current object ID.
Заметки
- Смотрите: Walker::start_el()
Список изменений
С версии 2.1.0 | Введена. |
Код WC_Product_Cat_Dropdown_Walker::start_el() WC Product Cat Dropdown Walker::start el WC 5.0.0
public function start_el( &$output, $cat, $depth = 0, $args = array(), $current_object_id = 0 ) {
if ( ! empty( $args['hierarchical'] ) ) {
$pad = str_repeat( ' ', $depth * 3 );
} else {
$pad = '';
}
$cat_name = apply_filters( 'list_product_cats', $cat->name, $cat );
$value = ( isset( $args['value'] ) && 'id' === $args['value'] ) ? $cat->term_id : $cat->slug;
$output .= "\t<option class=\"level-$depth\" value=\"" . esc_attr( $value ) . '"';
if ( $value === $args['selected'] || ( is_array( $args['selected'] ) && in_array( $value, $args['selected'], true ) ) ) {
$output .= ' selected="selected"';
}
$output .= '>';
$output .= esc_html( $pad . $cat_name );
if ( ! empty( $args['show_count'] ) ) {
$output .= ' (' . absint( $cat->count ) . ')';
}
$output .= "</option>\n";
}