- 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
推薦閱讀
- C#程序設計實訓指導書
- Building Modern Web Applications Using Angular
- VSTO開發入門教程
- Python高效開發實戰:Django、Tornado、Flask、Twisted(第3版)
- 飛槳PaddlePaddle深度學習實戰
- Learning Concurrency in Kotlin
- Python機器學習算法: 原理、實現與案例
- ASP.NET程序開發范例寶典
- JavaScript動態網頁編程
- Learning iOS Security
- Java程序設計教程
- 交互設計師成長手冊:從零開始學交互
- Java設計模式深入研究
- Python高性能編程(第2版)
- H5頁面設計與制作(全彩慕課版·第2版)