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

  • 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
主站蜘蛛池模板: 绥德县| 西贡区| 霞浦县| 聂拉木县| 洞头县| 南阳市| 祁东县| 旬邑县| 北川| 北川| 拜城县| 巩留县| 弋阳县| 遵义县| 西和县| 彩票| 清河县| 蕉岭县| 永丰县| 长乐市| 太仓市| 佳木斯市| 南和县| 琼结县| 西畴县| 南木林县| 仁怀市| 龙海市| 青浦区| 额尔古纳市| 临西县| 电白县| 虎林市| 界首市| 理塘县| 马尔康县| 卢龙县| 双桥区| 绥中县| 滦平县| 伊春市|