- 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
推薦閱讀
- 大話PLC(輕松動(dòng)漫版)
- 解構(gòu)產(chǎn)品經(jīng)理:互聯(lián)網(wǎng)產(chǎn)品策劃入門(mén)寶典
- Learning Real-time Processing with Spark Streaming
- 深度學(xué)習(xí)經(jīng)典案例解析:基于MATLAB
- 跟“龍哥”學(xué)C語(yǔ)言編程
- Web交互界面設(shè)計(jì)與制作(微課版)
- HTML5 移動(dòng)Web開(kāi)發(fā)從入門(mén)到精通(微課精編版)
- NetBeans IDE 8 Cookbook
- Python自然語(yǔ)言理解:自然語(yǔ)言理解系統(tǒng)開(kāi)發(fā)與應(yīng)用實(shí)戰(zhàn)
- Bitcoin Essentials
- Kotlin入門(mén)與實(shí)戰(zhàn)
- ServiceDesk Plus 8.x Essentials
- 程序員超強(qiáng)大腦
- C語(yǔ)言程序設(shè)計(jì)教程
- Tableau數(shù)據(jù)可視化從入門(mén)到精通