Cherry Toolkit module is designed for working inside the framework and contains (assistance) functions.
The module should be installed by default
This module should include static methods only
get_arg( $field, $arg, $default = '' );
Get argument from the array. In case the argument was not found, the $default parameter argument is used.
$field
- array - Arguments array$arg
- string | int | float - Arguments array key$default
- mixed - Returned default argument, if an argument was not found in the array by transferred key$arg
get_class_instance( $class_name = '', $core, $args );
Get new class entity. $core and $args are transferred to the class constructor as arguments.
$class_name
- string - Class name$core
- Cherry_Core - Cherry_Core entity$args
- array - Additional constructor arguments
render_view( $path, array $data = array() );
Data transition to the loaded template file. Execution result - HTML code.
$path
- string - Path to the template file$data
- array - Array with variables and their arguments. Variables will be available in the template
remove_empty( $arr );
Empty elements remove.
$arr
- array - Elements array
remove_empty_check( $var );
Function for variable empty value check.
$var
-mixed - variable
join( $arr = array() );
Function which unites array elements into the attributes string.
$arr
- array - Elements array
leave_right_keys( $right_keys, $array );
remove_right_keys( $right_keys, $array );
Function for working with arrays. Both functions check if the array elements are on the "blacklist" and delete them.