GeniXCMS

Params Class

categoryAPI edit_calendar31 Mar 2026

Post Metadata & Custom Fields Class


The Params class is the primary extensibility framework for the GeniXCMS content editor. It allows modules to inject custom input fields into the Post and Page management screens, automatically handling the rendering, retrieval, and mapping of metadata (Custom Fields) to specific content IDs.


⚡ Registering Custom Field Groups

Modules can register groups of fields to be displayed in either the Sidebar (compact) or the Bottom (expanded) sections of the editor form.

Params::register(array $config)

The core registration method used within a module's constructor or initialization hook.

$custom_meta = [
    'sidebar' => [ // Location: 'sidebar' or 'bottom'
        [
            'groupname'  => 'product_specification',
            'grouptitle' => 'E-Commerce Details',
            'fields'     => [
                [
                    'name'     => 'item_sku', 
                    'title'    => 'SKU Number',
                    'type'     => 'text',
                    'boxclass' => 'col-md-12'
                ],
                [
                    'name'     => 'item_condition',
                    'title'    => 'Condition',
                    'type'     => 'dropdown',
                    'value'    => ['New', 'Refurbished', 'Used'],
                    'boxclass' => 'col-md-12'
                ]
            ]
        ]
    ]
];

Params::register($custom_meta);

🏗️ Supported Component Types

The Params engine supports a variety of standard UI components for data entry:

Component Type Configuration Best Use Case
text Default Identifiers, SKU, prices, or external IDs.
textarea Default Short descriptions or custom code snippets.
checkbox Default Feature toggles (e.g., "Feature on Home").
dropdown Needs value array Statuses, categories, or predefined colors.

🔄 Technical Data Lifecycle

The Params class operates as an automated bridge between your module and the Posts model.

  1. Rendering: Hooks into post_param_form_sidebar and post_param_form_bottom.
  2. Hydration: Upon editor load, it automatically retrieves existing values using Posts::getParam($name, $post_id).
  3. Persistence: Field names are automatically prefixed. The core Posts::save() routine detects these parameters and commits them to the postparam table during the primary save transaction.

🛠️ Direct Rendering Utilities

While usually automated via hooks, developers can manually trigger metadata form rendering.

  • Params::renderSidebar(): Compiles and outputs all registered sidebar groups.
  • Params::renderBottom(): Compiles and outputs all registered bottom-area groups.

lightbulb
TipDeveloper Hint: To retrieve your custom parameters in a theme's single.php, use the Posts class helper: $price = Posts::getParam('product_price', $id);

See Also