本文整理汇总了PHP中PageManager::hasChildPages方法的典型用法代码示例。如果您正苦于以下问题:PHP PageManager::hasChildPages方法的具体用法?PHP PageManager::hasChildPages怎么用?PHP PageManager::hasChildPages使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PageManager
的用法示例。
在下文中一共展示了PageManager::hasChildPages方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __actionDelete
public function __actionDelete($pages, $redirect)
{
$success = true;
$deleted_page_ids = array();
if (!is_array($pages)) {
$pages = array($pages);
}
/**
* Prior to deleting Pages
*
* @delegate PagePreDelete
* @since Symphony 2.2
* @param string $context
* '/blueprints/pages/'
* @param array $page_ids
* An array of Page ID's that are about to be deleted, passed
* by reference
* @param string $redirect
* The absolute path that the Developer will be redirected to
* after the Pages are deleted
*/
Symphony::ExtensionManager()->notifyMembers('PagePreDelete', '/blueprints/pages/', array('page_ids' => &$pages, 'redirect' => &$redirect));
foreach ($pages as $page_id) {
$page = PageManager::fetchPageByID($page_id);
if (empty($page)) {
$success = false;
$this->pageAlert(__('Page could not be deleted because it does not exist.'), Alert::ERROR);
break;
}
if (PageManager::hasChildPages($page_id)) {
$this->_hilights[] = $page['id'];
$success = false;
$this->pageAlert(__('Page could not be deleted because it has children.'), Alert::ERROR);
continue;
}
if (!PageManager::deletePageFiles($page['path'], $page['handle'])) {
$this->_hilights[] = $page['id'];
$success = false;
$this->pageAlert(__('One or more pages could not be deleted.') . ' ' . __('Please check permissions on %s.', array('<code>/workspace/pages</code>')), Alert::ERROR);
continue;
}
if (PageManager::delete($page_id, false)) {
$deleted_page_ids[] = $page_id;
}
}
if ($success) {
/**
* Fires after all Pages have been deleted
*
* @delegate PagePostDelete
* @since Symphony 2.3
* @param string $context
* '/blueprints/pages/'
* @param array $page_ids
* The page ID's that were just deleted
*/
Symphony::ExtensionManager()->notifyMembers('PagePostDelete', '/blueprints/pages/', array('page_ids' => $deleted_page_ids));
redirect($redirect);
}
}