contextualcode / site-link-bundle
eZ Platform / eZ Publish 扩展包,用于修复跨站访问链接、链接媒体类型等。
Requires
- php: >=7.1
- ibexa/content: ^4.3
This package is not auto-updated.
Last update: 2024-09-23 15:46:09 UTC
README
这是一个用于修复跨站访问链接、链接媒体类型等问题的 eZ Platform / eZ Publish 5 Symfony 扩展包。
安装
运行 composer require
$ composer require contextualcode/site-link-bundle
在 app/AppKernel.php
(ezpublish/EzPublishKernel.php
) 中启用该扩展包,通过在 registerBundles
方法中添加以下行实现
public function registerBundles()
{
$bundles = array(
...
new ContextualCode\SiteLinkBundle\ContextualCodeSiteLinkBundle(),
...
);
使用方法
一旦扩展包启用并配置,使用方法将是自动的。
您可以使用 site-link-cross-siteaccess
参数来禁用跨站访问链接。例如
{{ path( 'ez_urlalias', { 'locationId': 2, 'site-link-cross-siteaccess': false }) }}
$router->generate('ez_urlalias', ['locationId' => 2, 'site-link-cross-siteaccess' => false]);
示例配置条目
该扩展包包含一些可以在 config.yml
中配置的选项。例如
contextual_code_site_link:
siteaccess_host_match_method: "first"
internal_external:
- class_identifier: link
external_attribute_identifier: external_link
internal_attribute_identifier: internal_link
- class_identifier: banner
external_attribute_identifier: external_link
internal_attribute_identifier: internal_link
direct_file_link:
- class_identifier: file
attribute_identifier: file
direct_image_link:
- class_identifier: image
attribute_identifier: image
siteaccess_host_match_method:可以是 "none"、"first" 或 "best"。这控制了跨站访问链接的处理方式。"first" 将使用您的站点访问配置中可用的第一个域名。"best" 将使用与当前域名匹配部分最多的站点访问域名。
internal_external:期望是一个数组,每个元素都有 class_identifier,可选的 external_attribute 和可选的 internal_attribute。将这些视为 "如果可能,链接到外部内容,否则链接到内部内容 ID"。
direct_file_link:期望是一个数组,每个元素都有 class_identifier 和指向文件类型字段的 attribute_identifier。链接到这些对象将直接链接到 /content/download 文件链接。
direct_image_link:与 direct_file_link 相同,但将直接链接到图像。