- concrete5 Cookbook
- David Strack
- 152字
- 2021-08-13 16:15:55
Getting a page type's name
Page type objects also contain methods to retrieve the name of the page type. In this exercise, we will load a page type by its handle, and then retrieve the name of the page type.
Getting ready
We will be loading a page type with the handle of right_sidebar
, so if that page type does not exist in your instance of concrete5, please adapt this recipe to suit your needs.
How to do it...
The steps for getting a page type's name are as follows:
- Open
/config/site_post.php
in your preferred code editor. - Load the page type by its handle:
$pageType = CollectionType::getByHandle('right_sidebar');
- Get the name of the page type.
$name = $pageType->getCollectionTypeName();
- Dump the name using our custom debugger.
my_debug($name);
How it works...
The getCollectionTypeName
function simply returns the string value of the page type's name.
See also
- The Getting a page type by its handle recipe
推薦閱讀
- Mastering Objectoriented Python
- C語言從入門到精通(第4版)
- Jupyter數(shù)據(jù)科學實戰(zhàn)
- Go并發(fā)編程實戰(zhàn)
- ASP.NET Core 2 Fundamentals
- 利用Python進行數(shù)據(jù)分析
- Unity 3D/2D移動開發(fā)實戰(zhàn)教程
- 打開Go語言之門:入門、實戰(zhàn)與進階
- Maker基地嘉年華:玩轉樂動魔盒學Scratch
- 零基礎輕松學C++:青少年趣味編程(全彩版)
- Implementing Microsoft Dynamics NAV(Third Edition)
- 啊哈C語言!:邏輯的挑戰(zhàn)(修訂版)
- 信息學奧林匹克競賽初賽精講精練
- Linux Networking Cookbook
- LabVIEW數(shù)據(jù)采集(第2版)