traw / vcfqr
创建带二维码的 vcf 卡片
0.1.2
2024-09-16 15:35 UTC
Requires
- chillerlan/php-qrcode: ^5.0
- friendsoftypo3/tt-address: ^8.0
- giggsey/libphonenumber-for-php: ^8.12
- sabre/vobject: ^4.0
- typo3/cms-fluid: ^12 || ^13
This package is auto-updated.
Last update: 2024-09-16 15:36:57 UTC
README
为 vcf 下载或 URL 创建二维码
安装
composer require traw/vcfqr
使用方法
可以使用现有的 ViewHelpers,或者调用 Service 类以进行自己的实现
设置
有一些扩展设置
- enableExamples: 使示例内容元素可用,展示 ViewHelpers 的使用方法,不要忘记添加 typoscript 包含
- storageUid: 您文件存储的 uid(例如 fileadmin,保留为
0
以使用默认存储) - qrfolder: qr 码文件应存储在您的
{storageUid}
内的文件夹名称 - qrcodeCacheLifetime: 文件在覆盖之前应缓存多长时间
- vcardVersion: 应使用哪个版本的 vCard(2.1、3.0 或 4.0)- 查看 https://de.wikipedia.org/wiki/VCard
可用的 ViewHelpers
为 typolink 创建二维码
例如,在内容元素中,添加链接/二维码 ViewHelper
<!-- Get the QR Code svg as inline html
<div style="width:300px;height:300px;">
<f:format.raw>
<vcf:link.QRCode parameter="{data.header_link}" fileName="{data.tx_vcfqr_filename}" returnValue="content"/>
</f:format.raw>
</div>
<!-- Get the QR Code svg in an image tag -->
<f:image src="{vcf:link.qRCode(fileName: data.tx_vcfqr_filename, parameter: data.header_link, returnValue: 'url')}" width="300" height="300" />
- 必须提供参数,例如 `t3://page=123`(但可以是任何配置在您的 Linkhandler 中的 typo3 页面、记录等的 URL)
- 必须提供 svg 的文件名
- returnValue 必须是
url
或content
(默认值)
创建下载地址记录 vCard 的二维码
例如,将其放置在 tt-address 部分中
<!-- Get the QR Code svg as inline html -->
<div style="width:300px;height:300px;">
<f:format.raw>
<vcf:address.qRCode address="{data.tx_vcfqr_address}" fileName="{data.tx_vcfqr_filename}" returnValue="content"/>
</f:format.raw>
</div>
<!-- Get the QR Code svg in an image tag -->
<f:image src="{vcf:address.qRCode(address: data.tx_vcfqr_address, fileName: data.tx_vcfqr_filename, returnValue: 'url')}" width="300" height="300" />
- 必须提供地址 uid
- (可选)必须提供 svg 的文件名,如果没有提供,则文件将命名为
{addressUid}_{currentPageUid}.svg
- returnValue 必须是
url
或content
(默认值)
创建下载地址记录 vCard 的链接
例如,将其放置在 tt-address 部分中
<vcf:address.vcf address="{data.tx_vcfqr_address}"
class="vcf-download"
additionalAttributes="{aria-role:'button'}"
title="Download vCard"
textWrap="<span>|</span>"
>Download vCard</vcf:address.vcf>
- 必须提供地址 uid
- class、additionalAttributes、title、textWrap 是可选的,并且与
f:link.typolink
中的操作类似