purplespider /asset-alt-text
为图像资产添加替代文本字段,因此您不需要使用图像的 '标题' 字段。
2.0.0
2024-06-28 13:13 UTC
Requires
- silverstripe/asset-admin: ^1.4 || ^2.0
Requires (Dev)
- phpunit/phpunit: ^9.5
README
为图像资产添加替代文本字段,因此您不需要使用图像的 标题
字段(通常比有用的替代文本更简洁)。
作为额外功能,当将图像添加到 HTMLEditorField
时,替代文本字段会自动填充任何资产的替代文本。
使用方法
通过 composer 安装 composer require purplespider/asset-alt-text
dev/build
转到 文件 并选择一个图像以查看新字段
要在模板中使用替代文本值,只需使用 $AltText
。例如。
<% with BannerImage %>
<img src="$URL" width="$Width" height="$Height" alt="$AltText" />
<% end_with %>