Automattic\WooCommerce\Internal\Admin

CategoryLookup::get_term_insert_values()protectedWC 1.0

Used to construct insert query recursively.

Метод класса: CategoryLookup{}

Хуков нет.

Возвращает

null. Ничего (null).

Использование

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->get_term_insert_values( $inserts, $terms, $parents );
$inserts(массив) (обязательный) (передается по ссылке — &)
Array of data to insert.
$terms(массив) (обязательный)
Terms to insert.
$parents(массив)
Parent IDs the terms belong to.
По умолчанию: array()

Код CategoryLookup::get_term_insert_values() WC 8.7.0

protected function get_term_insert_values( &$inserts, $terms, $parents = array() ) {
	foreach ( $terms as $term ) {
		$insert_parents = array_merge( array( $term['term_id'] ), $parents );

		foreach ( $insert_parents as $parent ) {
			$inserts[] = array(
				$parent,
				$term['term_id'],
			);
		}

		$this->get_term_insert_values( $inserts, $term['descendants'], $insert_parents );
	}
}