- 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
推薦閱讀
- Advanced Splunk
- 精通Nginx(第2版)
- PostgreSQL Cookbook
- Java Web基礎與實例教程(第2版·微課版)
- C語言程序設計實訓教程
- Spring Cloud、Nginx高并發核心編程
- Bootstrap Essentials
- Kotlin Standard Library Cookbook
- Learning OpenStack Networking(Neutron)
- ArcGIS for Desktop Cookbook
- GitHub入門與實踐
- PyQt編程快速上手
- Mastering JavaScript
- 你好!Java
- Tkinter GUI Programming by Example