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

  • 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
主站蜘蛛池模板: 仁怀市| 双鸭山市| 武宣县| 沈阳市| 疏附县| 和林格尔县| 余姚市| 瑞昌市| 寻甸| 柳江县| 儋州市| 友谊县| 固阳县| 衡阳县| 西乌珠穆沁旗| 翼城县| 香河县| 黄石市| 富平县| 抚顺市| 梁山县| 金堂县| 东辽县| 六安市| 中方县| 志丹县| 伊春市| 昆山市| 阆中市| 克东县| 东阿县| 汉川市| 崇信县| 孟津县| 深圳市| 恩施市| 湖南省| 贵定县| 体育| 桐庐县| 彭泽县|