- concrete5 Cookbook
- David Strack
- 165字
- 2021-08-13 16:15:56
Deleting a page type
In addition to adding and editing page types, you can also delete them.
Getting ready
Since deleting page types is a destructive action that is irreversible, it's a good idea to create a dummy page type with the handle of delete_me
for this exercise. We will also continue using site_post.php
to execute arbitrary code.
How to do it...
The steps for deleting a page type are as follows:
- Open
/config/site_post.php
in your preferred code editor. - Define the handle of the page to be deleted.
$handle = 'delete_me';
- Load the page type by its handle.
$pageType = CollectionType::getByHandle($handle);
- Now, delete the page type.
$pageType->delete();
How it works...
The delete()
function deletes the page type, the Master Collection, and all of the pages that use it. Use this function very cautiously, as once the data has been deleted, it cannot be recovered (unless you have a backup copy of the site's database).
See also
- The Getting a page type by its ID recipe
推薦閱讀
- LaTeX Cookbook
- Apache Oozie Essentials
- 匯編語言程序設計(第2版)
- 數據結構(Python語言描述)(第2版)
- Easy Web Development with WaveMaker
- TypeScript實戰指南
- Learning OpenStack Networking(Neutron)
- Windows內核編程
- Unity UI Cookbook
- C#應用程序設計教程
- 深度學習原理與PyTorch實戰(第2版)
- 深入淺出 HTTPS:從原理到實戰
- JBoss AS 7 Development
- Spring Boot 2+Thymeleaf企業應用實戰
- Three.js Essentials