craftcms/hexdec

为Craft添加新的hexdec过滤器,该过滤器将十六进制值转换为十进制。

3.1.0 2024-03-19 23:25 UTC

README

此插件为Craft添加了新的|hexdec Twig过滤器,该过滤器可以将十六进制值转换为十进制。

它是PHP的hexdec()函数的包装器。

{% set r = entry.colorField[1:2]|hexdec %}
{% set g = entry.colorField[3:2]|hexdec %}
{% set b = entry.colorField[5:2]|hexdec %}

要求

此插件需要Craft CMS 4.0.0+或5.0.0+。

安装

您可以从插件商店或使用Composer安装此插件。

从插件商店

转到您项目控制面板中的插件商店,搜索“Hexdec”,然后在模态窗口中点击“安装”按钮。

使用Composer

打开终端并运行以下命令

# go to the project directory
cd /path/to/my-project.test

# tell Composer to load the plugin
composer require craftcms/hexdec

# tell Craft to install the plugin
./craft install/plugin hexdec