当前位置: 首页>>代码示例>>PHP>>正文


PHP PageManager::addPageTypesToPage方法代码示例

本文整理汇总了PHP中PageManager::addPageTypesToPage方法的典型用法代码示例。如果您正苦于以下问题:PHP PageManager::addPageTypesToPage方法的具体用法?PHP PageManager::addPageTypesToPage怎么用?PHP PageManager::addPageTypesToPage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PageManager的用法示例。


在下文中一共展示了PageManager::addPageTypesToPage方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: updatePagesOfPrototype

 public static function updatePagesOfPrototype($prototype_id, $types)
 {
     if (empty($prototype_id)) {
         return;
     }
     $prototype = PageManager::fetchPageByID($prototype_id);
     $pages = self::fetchPagesOfPrototype($prototype_id);
     $fields = array();
     if (is_array($pages) && !empty($pages)) {
         foreach ($pages as $page) {
             $fields['params'] = $prototype['params'];
             $fields['events'] = $prototype['events'];
             $fields['data_sources'] = $prototype['data_sources'];
             PageManager::edit($page['id'], $fields, true);
             PageManager::addPageTypesToPage($page['id'], array_values(array_diff($types, array('prototype'))));
         }
     }
 }
开发者ID:klaftertief,项目名称:page_prototypes,代码行数:18,代码来源:class.pageprototypes.php

示例2: __actionEdit


//.........这里部分代码省略.........
                      * @delegate PagePreCreate
                      * @since Symphony 2.2
                      * @param string $context
                      * '/blueprints/pages/'
                      * @param array $fields
                      *  The `$_POST['fields']` array passed by reference
                      */
                     Symphony::ExtensionManager()->notifyMembers('PagePreCreate', '/blueprints/pages/', array('fields' => &$fields));
                     if (!($page_id = PageManager::add($fields))) {
                         $this->pageAlert(__('Unknown errors occurred while attempting to save.') . '<a href="' . SYMPHONY_URL . '/system/log/">' . __('Check your activity log') . '</a>.', Alert::ERROR);
                     } else {
                         /**
                          * Just after the creation of a new page in `tbl_pages`
                          *
                          * @delegate PagePostCreate
                          * @since Symphony 2.2
                          * @param string $context
                          * '/blueprints/pages/'
                          * @param integer $page_id
                          *  The ID of the newly created Page
                          * @param array $fields
                          *  An associative array of data that was just saved for this page
                          */
                         Symphony::ExtensionManager()->notifyMembers('PagePostCreate', '/blueprints/pages/', array('page_id' => $page_id, 'fields' => &$fields));
                         $redirect = "/blueprints/pages/edit/{$page_id}/created/{$parent_link_suffix}";
                     }
                 } else {
                     /**
                      * Just prior to updating a Page record in `tbl_pages`, provided
                      * with the `$fields` associative array. Use with caution, as no
                      * duplicate page checks are run after this delegate has fired
                      *
                      * @delegate PagePreEdit
                      * @since Symphony 2.2
                      * @param string $context
                      * '/blueprints/pages/'
                      * @param integer $page_id
                      *  The ID of the Page that is about to be updated
                      * @param array $fields
                      *  The `$_POST['fields']` array passed by reference
                      */
                     Symphony::ExtensionManager()->notifyMembers('PagePreEdit', '/blueprints/pages/', array('page_id' => $page_id, 'fields' => &$fields));
                     if (!PageManager::edit($page_id, $fields, true)) {
                         return $this->pageAlert(__('Unknown errors occurred while attempting to save.') . '<a href="' . SYMPHONY_URL . '/system/log/">' . __('Check your activity log') . '</a>.', Alert::ERROR);
                     } else {
                         /**
                          * Just after updating a page in `tbl_pages`
                          *
                          * @delegate PagePostEdit
                          * @since Symphony 2.2
                          * @param string $context
                          * '/blueprints/pages/'
                          * @param integer $page_id
                          *  The ID of the Page that was just updated
                          * @param array $fields
                          *  An associative array of data that was just saved for this page
                          */
                         Symphony::ExtensionManager()->notifyMembers('PagePostEdit', '/blueprints/pages/', array('page_id' => $page_id, 'fields' => $fields));
                         $redirect = "/blueprints/pages/edit/{$page_id}/saved/{$parent_link_suffix}";
                     }
                 }
             }
             // Only proceed if there was no errors saving/creating the page
             if (empty($this->_errors)) {
                 /**
                  * Just before the page's types are saved into `tbl_pages_types`.
                  * Use with caution as no further processing is done on the `$types`
                  * array to prevent duplicate `$types` from occurring (ie. two index
                  * page types). Your logic can use the PageManger::hasPageTypeBeenUsed
                  * function to perform this logic.
                  *
                  * @delegate PageTypePreCreate
                  * @since Symphony 2.2
                  * @see toolkit.PageManager#hasPageTypeBeenUsed
                  * @param string $context
                  * '/blueprints/pages/'
                  * @param integer $page_id
                  *  The ID of the Page that was just created or updated
                  * @param array $types
                  *  An associative array of the types for this page passed by reference.
                  */
                 Symphony::ExtensionManager()->notifyMembers('PageTypePreCreate', '/blueprints/pages/', array('page_id' => $page_id, 'types' => &$types));
                 // Assign page types:
                 PageManager::addPageTypesToPage($page_id, $types);
                 // Find and update children:
                 if ($this->_context[0] == 'edit') {
                     PageManager::editPageChildren($page_id, $fields['path'] . '/' . $fields['handle']);
                 }
                 if ($redirect) {
                     redirect(SYMPHONY_URL . $redirect);
                 }
             }
         }
         // If there was any errors, either with pre processing or because of a
         // duplicate page, return.
         if (is_array($this->_errors) && !empty($this->_errors)) {
             return $this->pageAlert(__('An error occurred while processing this form. See below for details.'), Alert::ERROR);
         }
     }
 }
开发者ID:davjand,项目名称:codecept-symphonycms-db,代码行数:101,代码来源:content.blueprintspages.php


注:本文中的PageManager::addPageTypesToPage方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。