- 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
推薦閱讀
- Designing Machine Learning Systems with Python
- PHP程序設(shè)計(慕課版)
- Python網(wǎng)絡(luò)爬蟲從入門到實踐(第2版)
- Android 7編程入門經(jīng)典:使用Android Studio 2(第4版)
- BIM概論及Revit精講
- Visual FoxPro程序設(shè)計習(xí)題集及實驗指導(dǎo)(第四版)
- Hands-On Nuxt.js Web Development
- Nagios Core Administration Cookbook(Second Edition)
- Mastering Elixir
- Learning Image Processing with OpenCV
- Java并發(fā)實現(xiàn)原理:JDK源碼剖析
- AngularJS UI Development
- 一步一步學(xué)Spring Boot:微服務(wù)項目實戰(zhàn)(第2版)
- 青少年P(guān)ython趣味編程
- Beginning PHP