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

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
主站蜘蛛池模板: 金塔县| 襄垣县| 九龙县| 广宁县| 忻州市| 芮城县| 葵青区| 新晃| 禹城市| 信丰县| 保康县| 光泽县| 张家口市| 改则县| 大埔县| 丰宁| 那坡县| 莲花县| 唐海县| 汝阳县| 桃园市| 湖南省| 历史| 乌恰县| 商都县| 湖口县| 太保市| 肥乡县| 分宜县| 舒城县| 宜都市| 吴堡县| 达尔| 嘉峪关市| 固安县| 阳高县| 德兴市| 秦皇岛市| 邹平县| 赣州市| 昆山市|