Legacy Controls
Here are the legacy control types.
- Align
- Color
- Date
- Dimension
- Gallery
- Gradient
- Image
- Number
- Post Query
- Rich text editor
- Select
- Switch
- Text
- Select2
Displaying a legacy control value
The control values that the user enters (or selects) in legacy controls can be referenced as placeholders in HTML, Sass, or JavaScript.
Each placeholder is the control name surrounded by {{ and }}.
The HTML template may look like this.
<h1>{{ text }}</h1>
For Sass, the control value will also be defined as a variable starting with $.
h1 {
color: $text-color;
}
Note that Sass styles are automatically wrapped in a unique class name (not shown in the code) to target the block only.
It's possible to get this unique class name in templates, scripts and styles by using the {{ wrapper-class }} value.
Control types
Align
<Control type="align" name="align_control_name" label="Align" default="right" />
- Attributes
default- (optional) Accepted value:right,center,left
- Context
templatestylescript
Color
<Control type="color" name="color_control_name" label="Color control" default="#FFFFFF" />
- Attributes
alpha- (optional) If opacity is enable - defaulttruedefault- (optional) Accepted value:rgb(),rgba(),hex
- Context
templatestylescript
Date
<Control type="date" name="date_control_name" label="Date" format="Y-m-d H:i:s" />
- Attributes
format- (optional) Date format - defaultd/m/Y
- Context
templatestylescript
Dimension
<Control type="dimension" name="dimension_control_name" label="Dimension control">
<Key units>px,vh,vw</Key>
<Key default_unit>px</Key>
</Control>
- Attributes
default- (optional) Default value - default0,0,0,0(default="0"ifmultiple_valuesisfalse)units- (optional) Accepted units - defaultpxdefault_unit- (optional) Default unit - defaultpxmultiple_values- (optional) Enter 1 or 4 values - defaulttrue
- Subvalues
top- Top valueright- Right valuebottom- Bottom valueleft- Left valueunit- Unit used
- Context
templatestylescript
Gallery
<Control type="gallery" name="gallery_control_name" label="Gallery control" size="full" />
- Attributes
default- (optional) Attachment ID(s)size- (optional) Size of the images - defaultfull
- Subvalues
ids- Attachment ids
- Context
templatestylescript
Gradient
<Control type="gradient" name="gradient_control_name" label="Gradient control" />
- Context
templatestylescript
Image
<Control type="image" name="image_control_name" label="Image control">
<Key default>https://ps.w.org/tangible-loops-and-logic/assets/banner-1544x500.jpg</Key>
</Control>
- Attributes
default- (optional) Accepted value:url,attachment id
- Subvalues
id- Get attachment idtitle- Get attachment titlealt- Get attachment altcaption- Get attachment captiondescription- Get attachment description
- Context:
templatestylescript
Number
<Control type="number" name="number_control_name" label="Number control" min="0" max="100">
<Key default>50</Key>
</Control>
- Attributes
min- (optional) Minimum value. Example : if min equal 0, so your number can't be less than 0.max- (optional) Maximum value. Example : if max equal 100, so your number can't be better than 100.
- Context
templatestylescript
Post Query
<Control type="post_query" name="post_query_control_name" label="Post query control" include_fields="taxonomy, type, order, orderby" />
- Attributes
include_fields- (optional) Fields displayed for query options - defaulttype, order, orderby
- Context
templatestylescript
Rich text editor
<Control type="editor" name="editor_control_name" label="Rich text editor control">
<Key default>Some <strong>text</strong></Key>
</Control>
- Attributes
default- (optional) Accepted value:html
- Context
template
Select
<Control type="select" name="select_control_name" label="Select control" default="one">
<Map options>
<Key one>Option one</Key>
<Key two>Option two</Key>
<Key three>Option three</Key>
</Map>
</Control>
- Attributes
options- (required) Value and label of the optionsmultiple- (optional) If the control allows mutiple values - defaultfalse
- Context
templatestylescript
Switch
<Control type="switch" name="switch_control_name" label="Switch control">
<Key value_on>on</Key>
<Key label_on>On</Key>
<Key value_off>off</Key>
<Key label_off>Off</Key>
</Control>
In Beaver Builder, a switch control will be displayed as a select.
- Attributes
value_on- (optional) Value returned when switch enabled - defaultonvalue_off- (optional) Value returned when switch disabled - defaultofflabel_on- (optional) Text displayed in the builder when switch enabled - defaultnonelabel_off- (optional) Text displayed in the builder when switch disabled - defaultnone
- Context
templatestylescript
Text
<Control type="text" name="text_control_name" label="Text control" default="default text" />
- Context
templatestylescript- In scripts, text will be outputed with quotes
Select2
<Control type="select2" name="select2_control_name" label="Select2" />
- Attributes
multiple- (optional) Select multiple value - defaultfalseoptions- (optional) Options display in the select - defaultnone
- Context
templatestylescript