Created
February 21, 2019 16:53
-
-
Save Pebblo/48c3d55ed6eb8e6eb9e905ef0812f267 to your computer and use it in GitHub Desktop.
Example of using the `FHEE__EE_Form_Input_Base___construct__input_args` hook to change the Venue Select dropdown selections on the event editor.
This file contains 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 //Please do not add the opening PHP tag if you already have one. | |
add_filter('FHEE__EE_Form_Input_Base___construct__input_args', 'tw_test', 10, 2); | |
function tw_test( $input_args, $input_obj) { | |
if( | |
!empty($input_args['html_name']) | |
&& $input_args['html_name'] === 'venue_id' | |
&& $input_obj instanceof EE_Select_Input | |
) { | |
$options = $input_obj->options(); | |
foreach($options as $key => $value){ | |
if($key !== 0) { | |
$options[$key] = $value . ' Test'; | |
} | |
} | |
$input_obj->set_select_options($options); | |
} | |
return $input_args; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment