Globals
These global field options are generally available for all fields. If you find any issues using them with any fields please report them to us. Thank you!

Basic Values

1
// ----------------------------------------------------------------------------------------------------
2
// General Field Options
3
// ----------------------------------------------------------------------------------------------------
4
5
$this_field_demo->title("$this_singular_name Title");
6
$this_field_demo->horizontal(TRUE); // Set layout to Title above field instead of on left // default FALSE
7
$this_field_demo->debug(FALSE); // default FALSE
Copied!

Description Values

1
// ----------------------------------------------------------------------------------------------------
2
// Descriptive Field Options
3
// ----------------------------------------------------------------------------------------------------
4
5
$this_field_demo->desc("$this_singular_name descripion"); // Appears below the title
6
$this_field_demo->desc_field("$this_singular_name descripion"); // Appears below the field
7
8
$this_field_demo->before("$this_singular_name descripion"); // Appears above the field
9
$this_field_demo->after("$this_singular_name descripion"); // Appears below the field
10
11
$this_field_demo->wrap_tooltip(
12
array(
13
"$this_singular_name Tooltip",
14
'followCursor' => TRUE
15
)
16
);
17
$this_field_demo->help([
18
'icon' => 'dashicons dashicons-format-status',
19
'theme' => 'light', // default dark
20
'size' => 'large', // Not sure if this changes anythiing in size @Issue
21
'content' => __('$this_singular_name Tooltip'),
22
'image' => '', // Full image url
23
'onShow' => 'function(a){ console.log(a);alert("Alert Triggered From PHP");}',
24
]);
Copied!

ID, Class & Style Values

1
// ----------------------------------------------------------------------------------------------------
2
// Field ID, Classes and Style Options
3
// ----------------------------------------------------------------------------------------------------
4
5
$this_field_demo->wrap_id('custom-field-id'); // Add a custom id to the field's container
6
$this_field_demo->wrap_class('custom-wrap-class col-xs-12 col-sm-12 col-md-12 col-lg-12 col-xl-12'); // Add a custom class to the field's container or adjust it's flexbox grid values
7
$this_field_demo->class('custom-field-class'); // Doesn't work with yet or with some fields, may be wrong method name @Issue
8
$this_field_demo->style('background-color: #000000;'); // Manually enter any inline css styles
9
$this_field_demo->style(
10
array(
11
'width' => 'auto',
12
'height' => 'auto'
13
)
14
); // Programmatically enter inlin css for the field width and height
Copied!

Attribute Values

1
// ----------------------------------------------------------------------------------------------------
2
// Field Container Attributes and Value Options
3
// ----------------------------------------------------------------------------------------------------
4
5
$this_field_demo->wrap_attribute('attribute-name', 'attribute-value'); // Load a single attribute name and value to the field
6
$this_field_demo->wrap_attributes(
7
array(
8
'attribute-name-1' => 'attribute-value-1',
9
'attribute-name-2' => 'attribute-value-2',
10
)
11
); // Load multiple attribute names and values to the field
12
13
// ----------------------------------------------------------------------------------------------------
14
// Field Attributes and Value Options
15
// ----------------------------------------------------------------------------------------------------
16
17
$this_field_demo->attribute('attribute-name', 'attribute-value'); // Load a single attribute name and value to the field
18
$this_field_demo->attributes(
19
array(
20
'attribute-name-1' => 'attribute-value-1',
21
'attribute-name-1' => 'attribute-value-2',
22
)
23
); // Load multiple attribute names and values to the field
24
25
$this_field_demo->field_default('Defaut_Value_Here'); // Not sure if this works @Issue
Copied!

Dependency Values

1
// ----------------------------------------------------------------------------------------------------
2
// Field Dependency Options
3
// $this_container->dependency('field_id_here', 'comparison_method_here', 'value');
4
// ----------------------------------------------------------------------------------------------------
5
6
// DOES EQUAL comparisons
7
8
$this_container->dependency('value_here', '=', TRUE);
9
$this_container->dependency('value_here', '=', '1');
10
$this_container->dependency('value_here', '=', 'string');
11
12
// DOES NOT EQUAL comparisons
13
14
$this_container->dependency('value_here', '!=', TRUE);
15
$this_container->dependency('value_here', '!=', '1');
16
$this_container->dependency('value_here', '!=', 'string');
17
18
// OR comparisons
19
20
$this_container->dependency('value_here', 'OR', TRUE);
21
$this_container->dependency('value_here', 'OR', '1');
22
$this_container->dependency('value_here', 'OR', 'string');
23
24
// ANY comparisons
25
26
$this_container->dependency('value_here', 'any', 'value_here_1,value_here_2,value_here_3');
Copied!

Validation Values

1
// ----------------------------------------------------------------------------------------------------
2
// Field Validation Options
3
// $this_container->dependency('field_id_here', 'comparison_method_here', 'value');
4
// ----------------------------------------------------------------------------------------------------
5
6
// JS Validation
7
// @Reference->https://jqueryvalidation.org/
8
9
$this_field_demo->js_validate('required'); // Forces field to have an entered value
10
$this_field_demo->js_validate(['key' => 'required', 'value' => 'required']); // Forces multiple fields to have an entered value
11
$this_field_demo->js_validate(['minlength' => 10,'maxlength' => 300,]); // Forces field to have a minimum character entered of 10 and max of 300
12
13
// PHP Validation
14
15
$this_field_demo->validate('wponion_is_required'); // Forces field to have an entered value
16
$this_field_demo->validate('wponion_is_email'); // Forces field to have a valid email address
17
$this_field_demo->validate('wponion_is_url'); // Forces field to have a valid url
18
$this_field_demo->validate(['wponion_is_required' => __('Custom validation message here...')]); // Adds a custom validation message
Copied!
Last modified 1yr ago