hofff / contao-consent-bridge
Contao与第三方扩展之间的同意工具桥接
1.5.0
2024-02-07 10:44 UTC
Requires
- php: ^8.1
- ext-json: *
- ext-pdo: *
- contao-community-alliance/meta-palettes: ^2.0
- contao/core-bundle: ^4.13 || ^5.0
- doctrine/dbal: ^3.4
- netzmacht/contao-toolkit: ^3.9 || ^4.0
- netzmacht/html: ^2.0 || ^3.0
- symfony/config: ^5.4 || ^6.4
- symfony/dependency-injection: ^5.4 || ^6.4
- symfony/http-kernel: ^5.4 || ^6.4
- symfony/translation-contracts: ^1.1 || ^2.0 || ^3.0
Requires (Dev)
- contao/manager-plugin: ^2.1
- doctrine/coding-standard: ^12.0
- friends-of-phpspec/phpspec-expect: ^4.0
- netzmacht/phpspec-phpcq-plugin: @dev
- phpcq/runner-bootstrap: ^1.0@dev
- phpspec/phpspec: ^7.4
README
此扩展提供将同意工具集成到Contao的桥接。
它适用于在客户端处理同意管理但可能需要修改HTML输出的同意工具。
要求
- Contao
^4.9
- PHP
^7.1 || ^8.0
安装
您可以使用Composer/Contao Manager安装 hofff/contao-consent-bridge
。
变更日志
查看 变更日志
特性
- 在根页面提供同意工具的激活
- 为内容元素分配所需的同意ID,并调整输出以满足同意工具的要求
- 为前端模块分配所需的同意ID,并调整输出以满足同意工具的要求
- 提供接口,以便可以调整特定前端模板的渲染以满足同意工具的要求
- 内置对页面布局中定义的Google Web字体支持
- 提供插件基础设施,以便支持扩展
- 提供同意工具的接口
集成
作为扩展开发者
如果您提供包含可能需要同意才能渲染的自定义内容元素或前端模块的扩展,您可以注册一个提供额外信息的插件。您需要将其标记为 hofff_contao_consent_bridge.plugin
。
namespace Your\Bundle; use Hofff\Contao\Consent\Bridge\Bridge; use Hofff\Contao\Consent\Bridge\Bridge\Plugin; use Hofff\Contao\Consent\Bridge\Render\RenderInformation; class MyPlugin implements \Hofff\Contao\Consent\Bridge\Plugin { public function load(Bridge $bridge): void { $bridge->supportFrontendModule('custom_1', RenderInformation::autoRenderWithoutPlaceholder()); $bridge->supportFrontendModule('custom_2', RenderInformation::autoRenderWithPlaceholder('custom_placeholder_template')); $bridge->supportFrontendModule('custom_3', RenderInformation::customRender()); $bridge->supportContentElement('custom_1', RenderInformation::autoRenderWithoutPlaceholder()); $bridge->supportContentElement('custom_2', RenderInformation::autoRenderWithPlaceholder('custom_placeholder_template')); $bridge->supportContentElement('custom_3', RenderInformation::customRender()); } }
然后,将会有一个新的图例,您可以在其中将同意ID分配给您的配置,并且HTML输出的渲染将根据同意工具的要求自动调整。
作为同意工具开发者
作为同意工具开发者,您需要实现接口 Hofff\Contao\Consent\Bridge\ConsentTool
并将其标记为 hofff_contao_consent_bridge.consent_tool
在依赖注入容器中。