Actions and filters

Smart_load_module

Action

This action is used for lazy loading. It's called when Smart module loaded. You can use SmartUtils::loadModules in this action.

function somefunction(){
    $modulesDir = "path to modules dir here";
    SmartUtils::loadModules($modulesDir);
}

add_action('Smart_load_module', 'somefunction');

Smart_modules

Filter

List of registered modules

$list = apply_filters('Smart_modules', array());

SmartModule_loaded

Action

This action is called when some module is loaded.

//Example
//Button module loaded
do_action('SmartComponentButton_loaded');

Smart_settings_list

Filter

List of the settings binded to component. It holds 2 parameters: settings list of the filtered component and it's name. $settings is a filtered parameter, that should be passed on. You can watch an example how to use this filter in the code below:

/**
* Add animation settings if condition equals true
* 
* @param array $settings Filtered parameter. Holds list of the settings for current component.
* @param string $name Name of the current component.
* @return array $settings
*/
function somefunction($settings, $name){
	$el = new $name;

	if(!isset($el->config()['animation']) || $el->config()['animation'] == true){
    	$settings[] = array(
        	'field' => 'select',
        	'name' => 'animation',
        	'label' => __('Animation type', $this->name()),
        	'values' => apply_filters('Smart_animation_list', array('no_animation' => __('Without animation', $this->name()))),
        	'default' => ''
    	);
    	$settings[] = array(
        	'field' => 'spiner',
        	'name' => 'delay',
        	'label' => __("Animation delay", $this->name()),
        	'min' => 0,
        	'max' => 1000,
        	'default' => '',
        	'rule' => array('hide' => array('animation' => 'no_animation'))
    	);
	}
        
	return $settings;
}

add_filter('Smart_settings_list', 'somefunction', 100, 2);

Smart_animaton_list

Filter

List of the animation type options for Animation module.

$animation_types = apply_filters('Smart_animation_list', array());

Smart_shortcode_render

Filter

Rendered content of registered component module.

$content = apply_filters('Smart_shortcode_render', 'Here goes rendered html content');

Smart_field_types

Filter

List of the all registered field types.

$fields = apply_filters('Smart_field_types', array());

Smart_shortcode_preview

Filter

Content rendered in the preview part of the component's editor pop-up window.

echo apply_filters('Smart_shortcode_preview', 'Here goes rendered html preview content');

Smart_icon_render

Filter

Icon html for settings.

$icon = apply_filters('Smart_icon_render', '', $params);

Smart_icon_list

Filter

List of the all supported icons.

echo apply_filters('Smart_icon_list', array());