Yoast\WP\SEO\Integrations\Admin
Admin_Columns_Cache_Integration::get_child_page_ids() private Yoast 1.0
Adds all child pages due to be shown on the current page to the $to_display array. Copied over with some changes from WP_Posts_List_Table::_page_rows.
{} Это метод класса: Admin_Columns_Cache_Integration{}
Хуков нет.
Возвращает
null.
Использование
// private - только в коде основоного (родительского) класса $result = $this->get_child_page_ids( $children_pages, $count, $parent, $start, $end, $to_display, $pages_map );
- $children_pages(массив) (обязательный) (передается по ссылке — &)
- The full map of child pages.
- $count(число) (обязательный) (передается по ссылке — &)
- The number of pages already processed.
- $parent(число) (обязательный)
- The parent that's currently being processed.
- $start(число) (обязательный)
- The number at which the current overview starts.
- $end(число) (обязательный)
- The number at which the current overview ends.
- $to_display(число) (обязательный) (передается по ссылке — &)
- The page IDs to be shown.
- $pages_map(число) (обязательный) (передается по ссылке — &)
- A map of page ID to an object with ID and post_parent.
Код Admin_Columns_Cache_Integration::get_child_page_ids() Admin Columns Cache Integration::get child page ids Yoast 15.6.2
private function get_child_page_ids( &$children_pages, &$count, $parent, $start, $end, &$to_display, &$pages_map ) {
if ( ! isset( $children_pages[ $parent ] ) ) {
return;
}
foreach ( $children_pages[ $parent ] as $page ) {
if ( $count >= $end ) {
break;
}
// If the page starts in a subtree, print the parents.
if ( $count === $start && $page->post_parent > 0 ) {
$my_parents = [];
$my_parent = $page->post_parent;
while ( $my_parent ) {
// Get the ID from the list or the attribute if my_parent is an object.
$parent_id = $my_parent;
if ( \is_object( $my_parent ) ) {
$parent_id = $my_parent->ID;
}
$my_parent = $pages_map[ $parent_id ];
$my_parents[] = $my_parent;
if ( ! $my_parent->post_parent ) {
break;
}
$my_parent = $my_parent->post_parent;
}
while ( $my_parent = \array_pop( $my_parents ) ) {
$to_display[] = $my_parent->ID;
}
}
if ( $count >= $start ) {
$to_display[] = $page->ID;
}
++$count;
$this->get_child_page_ids( $children_pages, $count, $page->ID, $start, $end, $to_display, $pages_map );
}
unset( $children_pages[ $parent ] ); // Required in order to keep track of orphans.
}