### Configuring Settings via JSON Source: https://context7.com/flydev-fr/processgeneralsettings/llms.txt Provides an example of how to define the structure of site settings using a JSON array. ```APIDOC ## Configuring Settings via JSON ### Description Define settings structure using JSON format in module configuration. Each setting requires an api name, label, type, and width. ### Method N/A (JSON configuration) ### Endpoint N/A ### Parameters N/A ### Request Example ```json [ { "api": "site_title", "label": "Site Title", "type": "Text", "width": "100", "description": "The main title of your website", "placeholder": "Enter site title", "collapsed": "Default", "value": "My Website" }, { "api": "theme_options", "label": "Theme Options", "type": "Fieldset", "width": "100", "collapsed": "collapsedYes" }, { "api": "theme_color", "label": "Theme Color", "type": "Select", "width": "50", "select": "Blue,Red,Yellow,Dark", "description": "Select the main theme color", "value": "Blue" }, { "api": "show_header", "label": "Show Header", "type": "Checkbox", "width": "50", "description": "Enable the site header", "value": "1" }, { "api": "theme_options_close", "label": "Close Theme Options", "type": "FieldsetClose", "width": "100" }, { "api": "social_icons", "label": "Social Icons", "type": "Checkboxes", "width": "100", "select": "facebook,twitter,instagram,linkedin", "description": "Select social icons to display", "value": ["facebook", "twitter"] } ] ``` ### Response N/A ``` -------------------------------- ### Rendering All Settings Source: https://context7.com/flydev-fr/processgeneralsettings/llms.txt Shows how to render all configured settings with their labels and values, useful for debugging or admin displays. ```APIDOC ## Rendering All Settings ### Description Display all configured settings with their labels and values using the render() method. ### Method N/A (PHP code examples) ### Endpoint N/A ### Parameters N/A ### Request Example N/A ### Response N/A ### Code Examples ```php render(); // Use in a template for debugging if ($user->isSuperuser()) { echo "
"; echo "

Current Settings

"; echo $settings->render(); echo "
"; } ?> ``` ### Output Example ```html

Site title (title) => My Website
Company Name (company) => Acme Corp
Phone (phone) => (555) 123-4567
Email (email) => info@example.com

``` ``` -------------------------------- ### Accessing Settings in ProcessWire Templates Source: https://context7.com/flydev-fr/processgeneralsettings/llms.txt Demonstrates how to retrieve and display site settings within PHP templates using the global $settings object or the wire() function. It also shows conditional logic and HTML integration. ```php site_name; echo wire('settings')->site_name; if ($settings->show_preheader) { echo "
{$settings->preheader_text}
"; } ?> <?= $settings->site_title ?> ``` -------------------------------- ### Rendering All Settings for Debugging Source: https://context7.com/flydev-fr/processgeneralsettings/llms.txt Uses the render() method to output all configured settings as a list, which is useful for debugging or displaying configuration values in the admin interface. ```php render(); if ($user->isSuperuser()) { echo "
"; echo "

Current Settings

"; echo $settings->render(); echo "
"; } ``` -------------------------------- ### Accessing Settings in Templates Source: https://context7.com/flydev-fr/processgeneralsettings/llms.txt Demonstrates how to access and utilize configured site settings within ProcessWire templates using PHP. ```APIDOC ## Accessing Settings in Templates ### Description Access any configured setting value using the global settings object in your ProcessWire templates. ### Method N/A (PHP code examples) ### Endpoint N/A ### Parameters N/A ### Request Example N/A ### Response N/A ### Code Examples ```php site_name; echo $settings->company_phone; echo $settings->footer_text; // Alternative syntax using wire() function echo wire('settings')->site_name; echo wire('settings')->company_phone; // Access in conditional logic if ($settings->show_preheader) { echo "
{$settings->preheader_text}
"; } ?> <?= $settings->site_title ?> ``` ``` -------------------------------- ### Rendering All Global Settings Source: https://github.com/flydev-fr/processgeneralsettings/blob/master/README.md Provides a method to render all configured global settings with their current values directly into the markup. This is a convenient way to display all settings at once. ```php $settings->render() ``` -------------------------------- ### Integrate General Site Settings in ProcessWire Templates Source: https://context7.com/flydev-fr/processgeneralsettings/llms.txt This snippet demonstrates how to access the global settings object in a ProcessWire _main.php template file. It shows how to output site metadata, conditional analytics scripts, and theme-specific CSS classes based on configured settings. ```php <?= $page->title ?> | <?= $settings->site_title ?> ga_id): ?> preheader_show): ?>
address ?> phone ?>
logo_left ?> logo_sub): ?> logo_sub ?>
``` -------------------------------- ### Defining Settings Structure via JSON Source: https://context7.com/flydev-fr/processgeneralsettings/llms.txt Shows how to define the module's settings fields using a JSON array. Each object defines the API name, label, type, and optional attributes like width and default values. ```json [ { "api": "site_title", "label": "Site Title", "type": "Text", "width": "100", "value": "My Website" }, { "api": "theme_color", "label": "Theme Color", "type": "Select", "width": "50", "select": "Blue,Red,Yellow,Dark", "value": "Blue" } ] ``` -------------------------------- ### Multilingual Settings Support Source: https://context7.com/flydev-fr/processgeneralsettings/llms.txt Explains how to configure and access multilingual settings, where the module automatically serves the correct language variant. ```APIDOC ## Multilingual Settings Support ### Description Create language-aware settings by appending the language name as a suffix. The module automatically returns the correct language variant based on user preferences. ### Method N/A (PHP and JSON examples) ### Endpoint N/A ### Parameters N/A ### Request Example ```json // JSON configuration example: [ {"api": "site_title", "label": "Site Title", "type": "Text", "width": "100", "value": "Welcome"}, {"api": "site_title_french", "label": "Site Title (French)", "type": "Text", "width": "100", "value": "Bienvenue"} ] ``` ### Response N/A ### Code Examples ```php site_title; // Outputs "Welcome" for default language // Outputs "Bienvenue" for French language users // Multi-language template example ?>

site_title ?>

tagline ?>

``` ``` -------------------------------- ### Accessing Global Settings in Templates Source: https://github.com/flydev-fr/processgeneralsettings/blob/master/README.md Demonstrates how to access global settings within ProcessWire template files. It shows both direct property access and access via the wire() service container. The module allows customization of the global settings variable name. ```php $settings->site_name // or wire('settings')->site_name ``` -------------------------------- ### Multilanguage Settings Implementation Source: https://github.com/flydev-fr/processgeneralsettings/blob/master/README.md Explains how to make global settings language-aware. By appending a language suffix (e.g., '_french') to the property name of additional fields, the module will automatically serve the correct language-specific value based on the user's current language. ```php // Example: For a 'site_title' setting // Create fields: 'site_title' (default) and 'site_title_french' // Access in template: $settings->site_title ``` -------------------------------- ### Implementing Multilingual Settings Source: https://context7.com/flydev-fr/processgeneralsettings/llms.txt Explains how to handle multilingual content by creating language-specific fields. The module automatically resolves the correct value based on the current user's language. ```php site_title; // Example usage in a header ?>

site_title ?>

tagline ?>

``` -------------------------------- ### Access Settings via Global Variable Source: https://context7.com/flydev-fr/processgeneralsettings/llms.txt Shows how to access module settings in PHP templates. It covers using the default global variable, aliasing the variable for cleaner code, and accessing settings within custom functions. ```php site_name; echo wire('site')->phone; // In _init.php or template, you can create shortcuts $s = wire('g_settings'); echo $s->company_name; echo $s->contact_email; // Using in functions function getSiteSetting($key) { return wire('g_settings')->$key; } echo getSiteSetting('site_title'); ``` -------------------------------- ### Configure Collapsed Field States Source: https://context7.com/flydev-fr/processgeneralsettings/llms.txt Demonstrates how to control the visibility and collapse behavior of fields in the admin interface using the 'collapsed' property. Options include never collapsing, collapsing when blank, or forcing a collapsed state. ```json [ { "api": "always_visible", "label": "Always Visible Field", "type": "Text", "width": "100", "collapsed": "collapsedNever" }, { "api": "hidden_when_empty", "label": "Collapsed When Blank", "type": "Text", "width": "100", "collapsed": "collapsedBlank" }, { "api": "always_collapsed", "label": "Always Collapsed", "type": "Textarea", "width": "100", "collapsed": "collapsedYes" }, { "api": "default_behavior", "label": "Default Collapse Behavior", "type": "Text", "width": "100", "collapsed": "Default" } ] ``` -------------------------------- ### Define Supported Field Types Source: https://context7.com/flydev-fr/processgeneralsettings/llms.txt Defines the JSON schema for various input field types supported by the module, including text, email, select, and fieldset grouping. Each object specifies an API key, label, type, and layout width. ```json [ {"api": "text_field", "label": "Text Input", "type": "Text", "width": "100"}, {"api": "textarea_field", "label": "Long Text", "type": "Textarea", "width": "100"}, {"api": "email_field", "label": "Email Address", "type": "Email", "width": "50"}, {"api": "url_field", "label": "Website URL", "type": "URL", "width": "50"}, {"api": "number_field", "label": "Count", "type": "Integer", "width": "30"}, {"api": "checkbox_field", "label": "Enable Feature", "type": "Checkbox", "width": "50"}, {"api": "select_field", "label": "Choose Option", "type": "Select", "width": "50", "select": "option1,option2,option3"}, {"api": "radios_field", "label": "Pick One", "type": "Radios", "width": "50", "select": "yes,no,maybe"}, {"api": "checkboxes_field", "label": "Select Multiple", "type": "Checkboxes", "width": "100", "select": "red,green,blue"}, {"api": "page_select", "label": "Select Page", "type": "PageListSelect", "width": "100"}, {"api": "info_markup", "label": "Instructions", "type": "Markup", "width": "100", "description": "This text appears as help info"}, {"api": "group_start", "label": "Settings Group", "type": "Fieldset", "width": "100"}, {"api": "group_end", "label": "End Group", "type": "FieldsetClose", "width": "100"} ] ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.