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

  • concrete5 Cookbook
  • David Strack
  • 179字
  • 2021-08-13 16:15:55

Getting a page type's handle

If a page type has been loaded by its ID or has been provided in a different manner, developers may want to retrieve the handle of the page type. In this example, we will load a page type with an ID of 4 and use the concrete5 API to get its handle.

Getting ready

We will be loading a page type with an ID of 4, so please ensure that this exists in your concrete5 website. Feel free to change the ID in this recipe to something appropriate for your instance of concrete5.

How to do it...

The steps for getting a page type's handle are as follows:

  1. Open /config/site_post.php in your preferred code editor.
  2. Load the page type by its ID.
    $pageType = CollectionType::getByID(4);
  3. Get the handle of the page type.
    $handle = $pageType->getCollectionTypeHandle();
  4. Dump the handle using our custom debugger function.
    my_debug($handle);

How it works...

The function getCollectionTypeHandle of the page type object returns the handle string of the page type.

See also

  • The Getting a page type by its ID recipe
主站蜘蛛池模板: 安乡县| 日喀则市| 磴口县| 卫辉市| 苍南县| 常州市| 南涧| 吉隆县| 长春市| 工布江达县| 连城县| 永清县| 丰县| 绍兴县| 重庆市| 西青区| 闽侯县| 双牌县| 金川县| 正蓝旗| 奈曼旗| 北川| 武清区| 武山县| 宣汉县| 平乐县| 潜江市| 建瓯市| 秦皇岛市| 拉孜县| 隆回县| 西乌珠穆沁旗| 深泽县| 图片| 林州市| 阜南县| 澄迈县| 桐城市| 神池县| 安多县| 霍州市|