contextualcode / ezplatform-content-disposition-bundle
eZ Platform 扩展包,可指定下载内容处理的权限。
v3.2.0
2023-12-19 20:20 UTC
Requires
- ibexa/content: ^4.3
README
此扩展包允许自定义下载内容处理(内联或附件)。
您可以指定默认内容处理和按MIME类型的内容处理。
安装
- 运行
composer require
$ composer require contextualcode/ezplatform-content-disposition-bundle
- 在
config/bundles.php
中启用此扩展包,通过添加以下行
return [
...,
ContextualCode\EzPlatformContentDispositionBundle\ContextualCodeEzPlatformContentDispositionBundle::class => ['all' => true],
];
将此添加到您的 routes.yaml
content_disposition:
resource: '@ContextualCodeEzPlatformContentDispositionBundle/Resources/config/routing.yml'
使用方法
在某些 parameters
块中,例如在 config/services.yaml
中,您可以指定
默认内容处理
ibexa.site_access.config.global.download_content_disposition.default: inline
按MIME类型的内容处理
ibexa.site_access.config.global.download_content_disposition.mimetype: "application/pdf": inline "application/msword": attachment
使文件
cache-control: public, s-maxage=%download_content_disposition.download_file_ttl%
,并按用户上下文哈希值(默认:false
)进行变化。ibexa.site_access.config.default.download_content_disposition.public_download: true ibexa.site_access.config.default.download_content_disposition.download_file_ttl: 86400
如果未定义
download_content_disposition.download_file_ttl
设置,则将使用content.default_ttl
。