Properties

$version

$version : string

Current version.

Type

string

$base_url

$base_url : string

The plugin base url

Used when loading assets. If you decide to customize elementa assets; Copy them to another path and pass the path here. This makes it easy to upgrade to the next version of elementa

Type

string

$data_callbacks

$data_callbacks : string

Callbacks used to retrieve custom form data such as users and posts

You can register your own callback by calling self::register_data_callback()

Type

string

$_instance

$_instance : Object

The single instance of the class.

Type

Object

$instances

$instances : array

Unique registered instances (ids)

This is simply an array of options belonging to each unique id passed along when calling EL()

array( 'elements' => array(), Contains an array of all elements enqueud to this instance 'defaults' => array(), Contains all the default values declared for this instance 'user_settings' => array(), Contains the values a user sets )

Type

array

$hook_suffixes

$hook_suffixes : array

Unique hook suffixes

This is simply an array of hooks suffixes belonging to each unique id passed along when calling EL()

Used to conditionally load assets

Type

array

$elements

$elements : array

An array of all registered elements

Type

array

$instance_id

$instance_id : string

Current instance id Evaluates to the value passed onto EL() when accessing this object

Type

string

Methods

instance()

instance(  $instance_id = false) : \Elementa

Main Elementa Instance.

Ensures only one instance of Elementa is loaded or can be loaded.

Parameters

$instance_id

Returns

\Elementa —
  • Main instance.

__construct()

__construct() 

Elementa Constructor.

register_core_elements()

register_core_elements() 

Registers core elements

default_cb()

default_cb(  $args) 

A catch all callback that renders default elements

Parameters

$args

enque_select()

enque_select() 

Enques styles for select elements

enque_date()

enque_date() 

Enques styles for date elements

enque_color()

enque_color() 

Enques styles for color elements

register_multiple_elements()

register_multiple_elements(  $args = array()) 

Registers multiple elements at once

Parameters

$args

register_element()

register_element(  $element_type = false,   $args = array()) 

Registers a new element

An element needs a render callback at minimum

Parameters

$element_type
$args

get_registered_elements()

get_registered_elements() 

Returns a list of all registered elements

update_element()

update_element(  $element_type = false,   $key = false,   $value = false) 

Updates an existing element

Parameters

$element_type
$key
$value

queue_control()

queue_control(  $element_id = false,   $args = array()) 

Parameters

$element_id
$args

queue_element()

queue_element(  $element_id = false,   $args = array()) 

Queues an element for rendering

Parameters

$element_id
$args

render_element()

render_element(  $args = array()) 

Renders a registered element

Parameters

$args

render_wrapper_open()

render_wrapper_open(  $args) 

Outputs the settings page

Parameters

$args

render_wrapper_end()

render_wrapper_end(  $args) 

Outputs the closing wrapper around rendered elements

Parameters

$args

get_data()

get_data(  $type = '',   $args = array()) 

Returns the data provided by a given data callback

Parameters

$type
$args

register_data_callback()

register_data_callback(  $data,   $callback = array()) 

Registers data callbacks

Take a look at self::register_core_data_callbacks to see how it works. If the data callback exists; it will be overwritten. Make sure that The callback returns an array of name=>label pairs

Parameters

$data
$callback

get_registered_data_callbacks()

get_registered_data_callbacks() 

Returns an array of all registered data callbacks

register_core_data_callbacks()

register_core_data_callbacks() 

Registers multiple data callbacks

get_categories()

get_categories(  $args) 

Returns an array of post categories

Parameters

$args

get_tags()

get_tags(  $args) 

Returns an array of post tags

Parameters

$args

get_taxonomies()

get_taxonomies(  $args) 

Returns an array of taxonomies

Parameters

$args

get_posts()

get_posts(  $args) 

Returns an array of posts

Parameters

$args

get_menus()

get_menus(  $args) 

Returns an array of menus

Parameters

$args

get_pages()

get_pages(  $args) 

Returns an array of pages

Parameters

$args

get_post_types()

get_post_types(  $args) 

Returns an array of post types

Parameters

$args

get_post_statuses()

get_post_statuses(  $args) 

Returns an array of post statuses

Parameters

$args

get_countries()

get_countries(  $args) 

Returns an array of countries

Parameters

$args

get_users()

get_users(  $args) 

Returns an array of users

Parameters

$args

get_roles()

get_roles(  $args) 

Returns an array of user roles

Parameters

$args

get_capabilities()

get_capabilities(  $args) 

Returns an array of all user capabilities or capabilities for the given user type

Parameters

$args

titalize()

titalize(  $string) 

Converts a string to readable form

Parameters

$string

set_template()

set_template(  $template = false) 

Sets the rendering template

Parameters

$template

render()

render() 

Outputs the settings page

get_defaults()

get_defaults(  $instance_id) 

Returns all default values for the current instance

Parameters

$instance_id

get_options()

get_options() 

Returns default values for the current instance

get_option()

get_option(  $option = false) 

gets a user defined option

Parameters

$option

set_instance_args()

set_instance_args(  $args) 

Set special arguments for the instance

Parameters

$args

enqeue_scripts()

enqeue_scripts(  $hook_suffix) 

Adds stylesheets to the queue

Parameters

$hook_suffix

element_pluck()

element_pluck(  $property) 

Plucks a given property from all instances

Parameters

$property

modify_custom_data()

modify_custom_data(  $data,   $key,   $value) 

A helper function to modify custom data

It extracts the key and value fields from the data

Parameters

$data
$key
$value

save()

save() 

Saves submitted data

This is method is called when the render function is called to ensure that data is saved only when the right page is requested.

_save()

_save(  $data) 

Saves dava to the db

Parameters

$data

clean_args()

clean_args(  $args) 

Normalizes element render args

Parameters

$args