BoldMinded Docs
  • Overview
  • Advanced Categories
    • Docs
      • Installation
      • Requirements
      • Setup & Configuration
        • Hidden Config Options
        • Multi-Site Manager
      • Template Tags
      • FAQs
  • Ansel
    • Docs
      • Installation
      • Upgrading
      • Requirements
      • Settings
      • Usage
        • Channel:Form
      • Troubleshooting
      • Template Tags
    • FAQs
  • Bloqs
    • Docs
      • Why Bloqs?
      • Features
        • Add Bloq Menu
        • Nesting
        • Cloning
        • Drafts
        • Bloq Usage
        • Deprecated Bloqs
        • Caching
        • Profiling
        • Bloq Components
        • Bloq Groups
      • Installation
      • Requirements & Compatibility
      • Setup & Configuration
        • Hidden Config Options
      • Creating Bloqs
      • Template Tags
        • Twig
        • Examples
      • Context Variables
      • Add-on Developers
    • FAQs
  • Carson
    • Docs
      • Installation
      • Requirements
      • Fields
        • Omni
          • Hidden Config
        • Assistant
        • SEO
  • Custom System Messages
    • Docs
      • Installation
      • Requirements
      • Variables
      • Template Tags
  • DataGrab
    • Docs
      • Installation & Upgrading
      • Requirements
      • Troubleshooting
      • Configuring Imports
      • Running Imports
      • Automatic Imports
        • Importing with cron
        • Importing with cron (Deprecated)
      • Endpoints
      • Configuration Options
        • Config File Options
        • Increasing PHP memory limit
      • Import Types
        • CSV
          • Importing into Grid or Matrix field
        • JSON
          • Example file
        • WordPress
        • XML
          • Example file
        • Creating your own import type
      • Assigning Authors
      • Field Types
        • Assets
        • Ansel
        • Bloqs
        • Calendar
        • Channel Images
        • Date
        • File
        • File Grid
        • Fluid
        • Grid
        • Low Events
        • Relationships
        • Simple Grids & Tables
        • Tag & Tagger
        • Matrix (Deprecated)
        • Creating your own fieldtype
      • Publisher
      • Version 5.0
      • Version 6.0
    • FAQs
  • Feature Flags
    • Docs
      • Installation & Upgrading
      • Requirements
      • Configuration
      • Template Tags
      • A/B Testing
    • FAQs
  • Fluidity
    • Docs
      • Installation & Upgrading
      • Requirements
      • Configuration
      • Demos
    • FAQs
  • Logit
    • Docs
      • Installation
      • Requirements
      • Configuration
    • FAQs
  • Publisher
    • Docs
      • Installation
      • Requirements
      • Issues & Tips
      • Languages
      • Template Tags
        • Forms
        • Email Notification Templates
        • Channel:Form
        • Twig
      • URL Translations
      • Auto Translations
      • Diffs
      • Drafts
      • Categories
      • Phrases
      • Persistence
      • Performance
      • Add-ons
        • First Party
        • Third Party
      • Hidden Config
      • Extending Publisher
    • FAQs
  • Reading Time PRo
    • Docs
      • Installation
      • Requirements
      • Configuration
      • Template Tags
  • Reel
    • Docs
      • Installation
      • Requirements
      • Settings
      • Field Tags
    • FAQs
  • Simple Grids & Tables
    • Docs
      • Installation
      • Requirements
      • Template Tags
      • CSV File Imports
      • Field Settings
      • GraphQL
      • Advanced Configuration (deprecated)
    • FAQs
  • Sitemap
    • Docs
      • Installation
      • Requirements
      • Configuration & Usage
    • FAQs
  • Snaptcha
    • Docs
      • Installation
      • Requirements
      • Configuration
      • Template Tags
      • Developers
    • FAQs
  • Speedy
    • Docs
      • Installation & Updating
      • Requirements
      • Configuration
      • Template Tags
      • Static Caching
        • Real World Example
      • Frontedit Support
      • Control Panel
      • Migrating from CE Cache
      • Diagnostics
      • CLI Commands
      • Reverse Proxy Purging
    • FAQs
  • Trek (unreleased)
    • Docs
      • Configuration
    • FAQs
  • Queue
    • Docs
Powered by GitBook
On this page

Was this helpful?

  1. Feature Flags
  2. Docs

Template Tags

Last updated 1 year ago

Was this helpful?

Anywhere in your template you can reference an early parsed global variable for each feature flag to determine if content shouldbe shown. In this example if the new_product feature flag is enabled and active, then the text will be rendered.

{if feature:new_product}
    <p>Show me the money!</p>
{/if}

If a Feature Flag field is added to a channel you do not need to modify your template to show or hide the entry content. For example, the following custom field is added to a channel, and when editing an entry you will see in plain text what it wants to do. If the last dropdown option is set to "Hide" this entry, then the channel:entries tag will automatically remove the entry from the result loop if the new_product feature flag is enabled and active. If it is set to show, then it will only display the entry in the channel:entries tag when the new_product feature flag is enabled. If it is not enabled, it will skip the entry when looping over the channel:entries tag results.

A Feature Flags field when used as a channel field is the only time you won't be required to add a template conditional tag to show or hide your content.

{exp:channel:entries channel="pages"}
    <h1>{title}</h1>
{/exp:channel:entries}

If you add a Feature Flags field to Bloqs or Grid you will need to add a conditional to your template tag for this to work. For example we have 2 Conditional Display bloqs below. The first will display itself and it's child bloqs if the new_product feature flag is enabled and active. The second will not display itself or it's children if the feature flag is enabled and active.

{exp:channel:entries channel="pages"}
    <h1>{title}</h1>
    {bloqs}
        {conditional_display}
            {if display_content}
                <!-- Since all the other bloqs are children of the 
                Conditional Display bloq will display based on the condition
                of the Display Content field. -->
                {bloqs:children}
            {/if}
        {/conditional_display}

        {related_entries}
            ...
        {/related_entries}
        
        {asset}
            ...
        {/asset}
    {/bloqs}
    
    {grid}
        {if grid:display_content}
            <!-- This text will display if the 
            new_product flag is enabled and active. -->
        {/if}
    {/grid}
    
{/exp:channel:entries}

Using Feature Flags in JavaScript code

You can reference a feature flag in JavaScript if you add the {feature_flags:all} tag to your document, which will output JSON encoded string of the flags available, and their current status. For example:

{
    new_product: true,
    ab_test_carousel: false
}