- 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
推薦閱讀
- Mastering Objectoriented Python
- .NET 4.0面向?qū)ο缶幊搪劊夯A(chǔ)篇
- jQuery EasyUI網(wǎng)站開發(fā)實戰(zhàn)
- PhoneGap Mobile Application Development Cookbook
- Learning Data Mining with R
- Go并發(fā)編程實戰(zhàn)
- 學習OpenCV 4:基于Python的算法實戰(zhàn)
- HTML5 APP開發(fā)從入門到精通(微課精編版)
- Rust游戲開發(fā)實戰(zhàn)
- Kubernetes進階實戰(zhàn)
- Java編程從入門到精通
- Python函數(shù)式編程(第2版)
- Delphi開發(fā)典型模塊大全(修訂版)
- PHP+MySQL動態(tài)網(wǎng)站開發(fā)從入門到精通(視頻教學版)
- Software-Defined Networking with OpenFlow(Second Edition)