thelia/custom-fields-module

CustomFields module for Thelia

Maintainers

Package info

github.com/thelia-modules/CustomFields

Type:thelia-module

pkg:composer/thelia/custom-fields-module

Statistics

Installs: 0

Dependents: 0

Suggesters: 0

Stars: 1

Open Issues: 0

dev-main 2026-03-12 08:45 UTC

This package is not auto-updated.

Last update: 2026-03-12 15:23:41 UTC


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

  1. composer require thelia/custom-fields-module
  2. Activate the module in the back-office

Usage

Back-Office

  1. 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)
  2. 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
  3. 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 code
  • source: Source type (product, content, category, folder) - default : general
  • source_id: The entity ID (no need to specify for general source)
  • 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}