- 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
推薦閱讀
- Android Jetpack開發(fā):原理解析與應用實戰(zhàn)
- 深入淺出Windows API程序設計:編程基礎篇
- Mastering Python High Performance
- Getting Started with Greenplum for Big Data Analytics
- Angular開發(fā)入門與實戰(zhàn)
- Kubernetes進階實戰(zhàn)
- Visual Studio Code 權威指南
- Hadoop大數(shù)據(jù)分析技術
- HTML+CSS+JavaScript網(wǎng)頁制作:從入門到精通(第4版)
- Hands-On Robotics Programming with C++
- Mastering ASP.NET Core 2.0
- Flutter之旅
- MySQL核心技術與最佳實踐
- Unity與C++網(wǎng)絡游戲開發(fā)實戰(zhàn):基于VR、AI與分布式架構
- C#開發(fā)之道