Skip to content

Instantly share code, notes, and snippets.

@Pebblo
Created February 21, 2019 16:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Pebblo/48c3d55ed6eb8e6eb9e905ef0812f267 to your computer and use it in GitHub Desktop.
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.
<?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