Created
February 22, 2024 09:25
-
-
Save LaxusCroco/f8d5d1ac1a4e5bf5fdd04d979e03df15 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'jet-form-builder/content-filters', function( $filters ) { | |
class Separate_With_Spaces_JFB_Filter extends \Jet_Form_Builder\Classes\Filters\Base_Filter { | |
public function get_id(): string { | |
return 'separate_with_spaces'; | |
} | |
public function callback_args(): array { | |
return array( ',', ', ' ); | |
} | |
public function apply_macros( $value, ...$args ): string { | |
if ( ! is_string( $value ) ) { | |
return $value; | |
} | |
list( $delimiter_before, $delimiter_after ) = $args; | |
return wp_kses_post( implode( $delimiter_after, explode( $delimiter_before, $value ) ) ); | |
} | |
} | |
$filters[] = new Separate_With_Spaces_JFB_Filter(); | |
return $filters; | |
} ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment