thelia/custom-fields-module
最新稳定版本:1.0.5
Composer 安装命令:
composer require thelia/custom-fields-module
包简介
CustomFields module for Thelia
README 文档
README
A Thelia module to add custom fields to products, content, categories, and folders with multi-language support.
Features
- Create custom fields with different types (text, textarea, wysiwyg, content (ID), product (ID), folder (ID), category (ID))
- Assign custom fields to multiple sources (product, content, category, folder, general)
- Multi-language support for field values
- Tab integration in back-office edit pages
- Twig function for front-office display
Installation
composer require thelia/custom-fields-module- Activate the module in the back-office
Usage
Back-Office
-
Create Custom Fields: Go to Tools > Custom Fields
- Enter a title and unique code (e.g.,
warranty_period) - Select field type
- Choose which sources can use this field (product, content, category, folder, general)
- Enter a title and unique code (e.g.,
-
Edit Field Values: When editing a product/content/category/folder:
- Navigate to the "Custom Fields" tab
- Enter values for each language using the language selector
- Save changes
-
Edit Field Values General: Go to Tools > Custom Fields
- Navigate to the "General Fields" tab
- Enter values for each language using the language selector
- Save changes
Front-Office (Twig Templates)
Use the custom_field_value function to display custom field values:
{* Display custom field for current locale *}
{{ custom_field_value('warranty_period', 'product', product_id) }}
{* Display custom general field *}
{{ custom_field_value('warranty_period') }}
{* Display custom field for specific locale *}
{{ custom_field_value('warranty_period', 'product', product_id, 'en_US') }}
Parameters:
code: The custom field codesource: Source type (product,content,category,folder) - default :generalsource_id: The entity ID (no need to specify forgeneralsource)locale(optional): Specific locale (defaults to current session locale)
Example
{* In a product template *}
{if custom_field_value('warranty_period', 'product', $PRODUCT_ID)}
<div class="warranty">
<strong>Warranty:</strong>
{custom_field_value('warranty_period', 'product', $PRODUCT_ID)}
</div>
{/if}
统计信息
- 总下载量: 37
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: LGPL-3.0-or-later
- 更新时间: 2026-03-12