官术网_书友最值得收藏!

  • 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:

  1. Open /config/site_post.php in your preferred code editor.
  2. Load the page type by its handle:
    $pageType = CollectionType::getByHandle('right_sidebar');
  3. Get the name of the page type.
    $name = $pageType->getCollectionTypeName();
  4. 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
主站蜘蛛池模板: 广宁县| 盐源县| 定安县| 德钦县| 双牌县| 正定县| 炎陵县| 和平区| 大英县| 房产| 防城港市| 保定市| 宿州市| 鲁甸县| 陈巴尔虎旗| 嵩明县| 绥棱县| 松溪县| 濉溪县| 高青县| 瑞安市| 抚顺市| 晋州市| 兴义市| 宝应县| 原平市| 阿克陶县| 吉林市| 鄯善县| 内江市| 杭锦旗| 蒲江县| 获嘉县| 外汇| 丹棱县| 广平县| 河南省| 托里县| 谷城县| 潢川县| 科尔|