/** * Delivers all siblings of a given subpage (won't deliver siblings of top level pages, would be to much) * * @param Title $page The page to get the siblings from. * * @return Title[] All sibling pages of the given subpage. */ static function getSiblingPages( Title $page ) { $parent = SubpageInfo::getParentPage( $page ); if( empty ( $parent ) ) { return array(); } $siblingsAndMore = SubpageInfo::getSubpages( $parent ); $allSiblings = array(); foreach( $siblingsAndMore as &$potentialSibling ) { if( SubpageInfo::isSiblingOf( $page, $potentialSibling ) ) $allSiblings[] = $potentialSibling; } return $allSiblings; }