Skip to content

Instantly share code, notes, and snippets.

@ihslimn
Created November 20, 2023 12:04
Show Gist options
  • Save ihslimn/035bdf88c0b74bcac62752b54266e65d to your computer and use it in GitHub Desktop.
Save ihslimn/035bdf88c0b74bcac62752b54266e65d to your computer and use it in GitHub Desktop.
JetEngine Explode String callback
<?php
add_action( 'jet-engine/callbacks/register', function( $callbacks ) {
$args = array(
'explode_delimiter' => array(
'label' => 'Delimiter',
'type' => 'text',
'default' => ',',
),
);
$callbacks->register_callback( 'jec_explode_string', 'Explode String', $args );
function jec_explode_string( $string, $delimiter = ',' ) {
if ( empty( $delimiter ) && ! is_scalar( $string ) ) {
return $string;
}
return explode( $delimiter, $string );
}
} );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment