An add-on for the Statamic CMS to give admins the ability to edit a theme's global variables.
This is a modified version of statamic-global-variable-editor also included in this addon is the statamic-section-tabs add-on. Section fields in your theme globals will create tabs for your sections.
-
Download and unzip statamic-globes.
-
Drag
_add-ons/globes
into your site's_add-ons
folder. -
Open your
_config/settings.yaml
file and addglobes:true
to the_admin_nav
setting. -
Open your
_themes/[theme-name]/theme.yaml
file define the global variables you want to be editable. -
Create your yaml array of variables
globals:
-
name: phone
display: Phone
value: 555-555-5555
If you wanted to add another global variable, say an email address, your globals
variable would look like so:
globals:
-
name: phone
display: Phone
value: 555-555-5555
-
name: email
display: Email
value: you@yourdomain.com
The allowed types are:
checkbox
checkboxes
date
markitup
radio
redactor
- no file uploads howeverselect
tags
table
text
textarea
time
users
There are two available methods in the plugin. The default method used by calling globes will return the value of the requested variable. Using globes:check you can condition the output based on the value of the variable being true or false. Globes doesn't work with standard if statements use globes:check instead.
{{ globes:check name="<name>"}}
{{ globes name="<name>" }}
{{ /globes:check }}