本文整理汇总了PHP中PageManager::fetchChildPages方法的典型用法代码示例。如果您正苦于以下问题:PHP PageManager::fetchChildPages方法的具体用法?PHP PageManager::fetchChildPages怎么用?PHP PageManager::fetchChildPages使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PageManager
的用法示例。
在下文中一共展示了PageManager::fetchChildPages方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: editPageChildren
/**
* This function will update all children of a particular page (if any)
* by renaming/moving all related files to their new path and updating
* their database information. This is a recursive function and will work
* to any depth.
*
* @param integer $page_id
* The ID of the Page whose children need to be updated
* @param string $page_path
* The path of the Page, which is the handles of the Page parents. If the
* page has multiple parents, they will be separated by a forward slash.
* eg. article/read. If a page has no parents, this parameter should be null.
* @return boolean
*/
public static function editPageChildren($page_id = null, $page_path = null)
{
if (!is_int($page_id)) {
return false;
}
$page_path = trim($page_path, '/');
$children = PageManager::fetchChildPages($page_id);
foreach ($children as $child) {
$child_id = $child['id'];
$fields = array('path' => $page_path);
if (!PageManager::createPageFiles($page_path, $child['handle'], $child['path'], $child['handle'])) {
$success = false;
}
if (!PageManager::edit($child_id, $fields)) {
$success = false;
}
self::editPageChildren($child_id, $page_path . '/' . $child['handle']);
}
return $success;
}