itplusx/flexible-pages
Composer 安装命令:
composer require itplusx/flexible-pages
包简介
Supports the setup and management of custom page types.
README 文档
README
TYPO3 Extension flexible_pages
Setup custom page types in TYPO3 with ease.
This extensions reduces the registration of custom page types in TYPO3 to a simple setup using YAML files.
- Features
- Roadmap
- Installation
- Registering custom pages types
- Generic frontend list plugin (tx_flexiblepages_pagelist)
Features
✓ Register custom pages types within seconds
✓ Use custom or already registered icons
✓ Plugin to render menus / lists of pages by page types
Roadmap
- Create an generic icon with the staring letter of the label, if no icons have been registered
- Backend module to configure custom pages types. It's basically a configuration front end for the YAML file
- Enable setting custom position in pages select box
- Enable sorting by date
- Cli command to create page types
- BE Module
- List
- List pages with page type filter
- Bulk edit
- Configuration
- Configure page type in BE
- List
- Provide a nice way to extend custom page types with additional fields
1. Installation
1.1 Installation with composer
composer require itplusx/flexible-pages
1.2 Installation with the TYPO3 Extension Manager
Use the Extension Key flexible_pages in the TYPO3 Extension Manager.
2. Registering custom pages types
There are two ways to register custom pages types.
2.1 Using YAML configuration files (recommended)
The easiest way to add new page types is via YAML. Three different possibilities exist to add new pageTypes with YAML files:
- Using the global config directory path (like with the site configuration of the TYPO3 core)
- Using the extension Configuration directory path of your custom extension
- Adding a custom path
2.1.1 Using the global config directory
As with the site configuration of the TYPO3 core it is also possible to add YAML files inside the global config directory.
Example:
config/
└── flexible_pages/
└── myNewPageType.yaml
└── myOtherPageType.yaml
└── Articles
└── blogArticle.yaml
└── newsArticle.yaml
2.1.2 Using the extension Configuration directory
It is also possible for every third-party extension to use flexible_pages as base for adding custom pageTypes. To enable this just add a YAML configuration file to your own extension inside Configuration/Yaml/flexible_pages.
Example:
your_extensionkey/
└── Configuration/
└── Yaml
└── flexible_pages/
└── myNewPageType.yaml
└── myOtherPageType.yaml
└── Articles
└── blogArticle.yaml
└── newsArticle.yaml
2.1.3 Adding a custom path
Beside the first two pre-defined directory paths it is also possible to define a third custom path where your custom YAML files are stored. For this you could simply add the custom path to the extension configuration in Admin Tools -> Settings -> Extension Configuration -> flexible_pages or set $GLOBALS['TYPO3_CONF_VARS']['EXTENSIONS']['flexible_pages']['additionalYamlConfigPath'] in your ext_localconf.php.
2.1.4 YAML File Example
dokType: 87
label: 'My Custom pageType'
iconSet:
defaultIcon:
source: 'EXT:your_ext/Resources/Public/Icons/apps-pagetree-mycustompagetype.svg'
hideInMenuIcon:
identifier: 'apps-pagetree-page-frontend-user-hideinmenu'
rootPageIcon:
source: 'EXT:your_ext/Resources/Public/Icons/apps-pagetree-mycustompagetype-root.svg'
isDraggableInNewPageDragArea: true
2.2 Using ext_localconf.php
\ITplusX\FlexiblePages\Registry\PageTypesRegistration::registerPageType( 87 'My Custom pageType', [ \ITplusX\FlexiblePages\Configuration\IconSetConfiguration::ICON_TYPE_DEFAULT => [ 'source' => 'EXT:your_ext/Resources/Public/Icons/apps-pagetree-mycustompagetype.svg', ], \ITplusX\FlexiblePages\Configuration\IconSetConfiguration::ICON_TYPE_HIDE_IN_MENU => [ 'identifier' => 'apps-pagetree-page-frontend-user-hideinmenu', ] \ITplusX\FlexiblePages\Configuration\IconSetConfiguration::ICON_TYPE_ROOT_PAGE => [ 'source' => 'EXT:your_ext/Resources/Public/Icons/apps-pagetree-mycustompagetype-root.svg', ] ], 'isDraggableInNewPageDragArea' => true );
2.3 Configuration
2.3.1 Registration parameters
| Parameter | Type | Mandatory | Description |
|---|---|---|---|
| dokType | int | ✓ | The dokType to register the new pageType with |
| label | string | ✓ | The label of the new pageType |
| iconSet | array | ✓ | The iconSet array of the newPageType. (see: iconSet configuration parameters) |
| isDraggableInNewPageDragArea | bool | Defines if the new pageType is draggable from above the page tree. (Default: false) |
2.3.2 Icons parameters
| Parameter | Type | Mandatory | Description | Possible values |
|---|---|---|---|---|
| defaultIcon | array | ✓ | The default icon of the page. | - 'source' => '/path/to/file.png'(EXT: is allowed)- 'identifier' => 'already-registered-identifier' |
| hideInMenuIcon | array | The icon of the page when "hideInMenu" is checked. | - 'source' => '/path/to/file.png'(EXT: is allowed)- 'identifier' => 'already-registered-identifier' |
|
| rootPageIcon | array | The icon of the page when the page is selected as root page. | - 'source' => '/path/to/file.png'(EXT: is allowed)- 'identifier' => 'already-registered-identifier' |
3. Generic frontend list plugin (tx_flexiblepages_pagelist)
flexible_pages provides a generic list plugin to list pages by specific pageTypes. Some settings of this plugin can be configured by the user to make it as flexible as possible:
3.1 Extending templates
Extending the template select field makes it possible to add your own custom Templates. Custom templates can be added either by PageTS or the EXTCONF array.
3.1.1 Extending via PageTS
as associative array:
tx_flexiblepages {
tx_flexiblepages_pagelist {
templates {
myTemplate = My new template
myTemplate2 = My new template 2
}
}
}
as numeric array:
tx_flexiblepages {
tx_flexiblepages_pagelist {
templates {
0 = My new template
1 = My new template 2
}
}
}
3.1.2 Extending via EXTCONF
as associative array:
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['flexible_pages']['tx_flexiblepages_pagelist']['templates'] = [ 'myTemplate' => 'My new template', 'myTemplate2' => 'My new template 2', ];
as numeric array:
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['flexible_pages']['tx_flexiblepages_pagelist']['templates'] = [ 'My new template', 'My new template 2' ];
3.1.3 Adding custom template file
After extending the template configuration you want to add your custom template file. To do that you have to extend the fluid_styled_content rootPaths. You can either do this in your own extension by extending the lib.contentElement TypoScript (as described HERE) or you could use the constants provided by flexible_pages:
plugin.tx_flexiblepages.templateRootPathplugin.tx_flexiblepages.partialRootPathplugin.tx_flexiblepages.layoutRootPath
Finally you can add your custom template file in the previously specified templateRootPath.
File naming:
- When you chose to extend the templates with a associative array, your template file has to be named like the key (as upper camelcase; e.g
MyTemplate.html). - When you chose to extend the templates with a numeric array, your template file has to be named like the value (as upper camelcase; e.g
MyNewTemplate.html).
3.2 Extending orderBy
The orderBy selection can be extended as well to add custom order fields. For example if you added a new field type to your custom pageType you could also order by this field if necessary.
For every added custom orderBy item an ascending and descending variant is created. Custom order fields can be added either by PageTS or the EXTCONF array.
NOTE: The key of the orderBy item must be the name of the field in the database! Numeric arrays are not allowed here.
3.2.1 Extending via PageTS
tx_flexiblepages {
tx_flexiblepages_pagelist {
orderBy {
type = Type
}
}
}
3.2.2 Extending via EXTCONF
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['flexible_pages']['tx_flexiblepages_pagelist']['orderBy'] = [ 'type' => 'Type' ];
4. Working Example
For a working example please have a look at EXT:flexible_news. There you can see how simple it is to:
- Setup a new pageType with special icons and name
- Extend the template select of the tx_flexiblepages_pagelist CE
itplusx/flexible-pages 适用场景与选型建议
itplusx/flexible-pages 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 3.74k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2018 年 12 月 06 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「extension」 「pages」 「typo3」 「TYPO3 CMS」 「page based content」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 itplusx/flexible-pages 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 itplusx/flexible-pages 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 itplusx/flexible-pages 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
The "View Counter" bundle
A custom URL rule class for Yii 2 which allows to create translated URL rules
Adjacency List’ed Closure Table database design pattern implementation for Laravel. Includes restore of tree
Set Links with a specific language parameter
The Yii2 extension uses jQuery jquery.carousel-1.1.min.js and makes image carousel from php array of structure defined.
TYPO3 CMS extension to create gallery content element with preset crop ratios and pagination
统计信息
- 总下载量: 3.74k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-12-06