Skip to content

Commit

Permalink
Updated create_function to anonymous function.
Browse files Browse the repository at this point in the history
Related issue udx/wp-stateless#300
  • Loading branch information
Md. Alimuzzaman Alim committed Jan 6, 2019
1 parent 831cd7c commit e1a4bf7
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion lib/classes/class-carrington.php
Original file line number Diff line number Diff line change
Expand Up @@ -650,7 +650,18 @@ public function registerRow( $classname, $args = array() ) {
public static function add_module_style( $class = false, $image_path = '', $type = 'general' ) {

if( $image_path && $class ) {
add_filter( 'udx:theme:carrington:styles', create_function( '$options, $type="' . $type . '", $image_path="' . $image_path . '", $class="' . $class . '" ', ' $options[$type][$class] = $image_path; return $options; ' ) );
add_filter( 'udx:theme:carrington:styles', function($options, $_type = null, $_image_path = null, $_class = null ) use($type, $image_path, $class){
// Pre ES2015 JavaScript style default parameters.
if($_type == null)
$_type = $type;
if($_image_path == null)
$_image_path = $image_path;
if($_class == null)
$_class = $class;

$options[$_type][$_class] = $_image_path;
return $options;
} );
}

}
Expand Down

1 comment on commit e1a4bf7

@antonkorotkov
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Look correct

Please sign in to comment.