Walker::unset_children
Unsets all the children for a given top level element.
Метод класса: Walker{}
Хуков нет.
Возвращает
null. Ничего (null).
Использование
$Walker = new Walker(); $Walker->unset_children( $element, $children_elements );
- $element(объект) (обязательный)
- The top level element.
- $children_elements(массив) (обязательный) (передается по ссылке — &)
- The children elements.
Список изменений
| С версии 2.7.0 | Введена. |
Код Walker::unset_children() Walker::unset children WP 7.0.4
public function unset_children( $element, &$children_elements ) {
if ( ! $element || ! $children_elements ) {
return;
}
$id_field = $this->db_fields['id'];
$id = $element->$id_field;
if ( ! empty( $children_elements[ $id ] ) && is_array( $children_elements[ $id ] ) ) {
foreach ( (array) $children_elements[ $id ] as $child ) {
$this->unset_children( $child, $children_elements );
}
}
unset( $children_elements[ $id ] );
}