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

  • 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
主站蜘蛛池模板: 陵川县| 洪湖市| 黑河市| 高密市| 金阳县| 古蔺县| 长治市| 漠河县| 沐川县| 云浮市| 肇州县| 门头沟区| 同仁县| 色达县| 富顺县| 建始县| 平遥县| 西峡县| 秀山| 阳信县| 合水县| 台中市| 永顺县| 府谷县| 赤城县| 枣庄市| 清苑县| 东丰县| 高安市| 江口县| 霍城县| 金华市| 黄山市| 英德市| 广饶县| 肥东县| 临西县| 白玉县| 淅川县| 乐平市| 定远县|