Walker::unset_children()

最后更新于:2021-11-26 05:36:21

Walker::unset_children( object$e, array$children_elements)

Unset all the children for a given top level element.

参数

$e

(object) (Required)

$children_elements

(array) (Required)

源文件

文件: gc-includes/class-gc-walker.php

	public function unset_children( $e, &$children_elements ) {
		if ( ! $e || ! $children_elements ) {
			return;
		}

		$id_field = $this->db_fields['id'];
		$id       = $e->$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 ] );
	}