- concrete5 Cookbook
- David Strack
- 197字
- 2021-08-13 16:15:56
Updating a page type
Updating page types is very similar to creating a page type as discussed in the previous recipe.
How to do it...
First you will need to load an existing page type. You will need to pass in the same data array when updating page types as you would when creating them. The steps are as follows:
- Open
/config/site_post.php
in your code editor. - Declare the old handle and the new handle variables.
$handle = 'page_type_handle'; $newHandle = 'new_handle';
- Define the new
$data
array with the new handle and new name.$data = array( 'ctHandle' => $newHandle, 'ctName' => 'New Name' );
- If the page type exists, update it.
$pageType = CollectionType::getByHandle($handle); if ($pageType) { $pageType->update($data); }
- Verify that the page type was updated by visiting
/dashboard/pages/types
in your concrete5 website.
How it works...
concrete5 will update the record in the database for the loaded page type. The Master Collection page is not updated when this function is called. You also cannot pass a packaged object to the update function, as that is only necessary when first creating a page type.
See also
- The Creating a page type recipe
- The Deleting a page type recipe
推薦閱讀
- SQL Server 從入門到項目實踐(超值版)
- Implementing Modern DevOps
- Python自動化運維快速入門(第2版)
- HTML5+CSS3基礎開發教程(第2版)
- 薛定宇教授大講堂(卷Ⅳ):MATLAB最優化計算
- HTML5游戲開發案例教程
- 軟件品質之完美管理:實戰經典
- C語言程序設計
- 單片機C語言程序設計實訓100例
- Fast Data Processing with Spark(Second Edition)
- PHP 7從零基礎到項目實戰
- Python從入門到精通(第3版)
- Windows Phone 8 Game Development
- RESTful Web API Design with Node.js(Second Edition)
- 零基礎Linux從入門到精通