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

  • 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
主站蜘蛛池模板: 灌阳县| 南和县| 武汉市| 济源市| 舟曲县| 铁力市| 沙洋县| 旬阳县| 乐亭县| 江都市| 准格尔旗| 噶尔县| 宁津县| 苍梧县| 美姑县| 富平县| 贵港市| 清丰县| 鲁山县| 梁山县| 东乡县| 沧源| 灵台县| 留坝县| 鄂州市| 平乡县| 定日县| 杂多县| 云林县| 汕尾市| 卓资县| 泊头市| 六盘水市| 邛崃市| 东港市| 会泽县| 阿城市| 黄浦区| 图片| 合江县| 忻城县|