Alert: This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.
Warning: Array to string conversion in /home/customer/www/docs.automatorplugin.com/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 825
Warning: foreach() argument must be of type array|object, string given in /home/customer/www/docs.automatorplugin.com/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 830
Warning: Array to string conversion in /home/customer/www/docs.automatorplugin.com/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 825
Wpf_Tokens::handle_dynamic_select_labels( $token_info, array $form, $entry_choice, $choices )
Handles dynamic select field.
Warning: foreach() argument must be of type array|object, string given in /home/customer/www/docs.automatorplugin.com/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 830
Warning: Array to string conversion in /home/customer/www/docs.automatorplugin.com/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 825
Parameters Parameters
- $form
(Required) The form.
Return Return
(string) The selected value label.
Source Source
File: src/integrations/wpforms/tokens/wpf-tokens.php
private function handle_dynamic_select_labels( $token_info, $form, $entry_choice, $choices ) { list( $form_id, $field_id, $label_flag ) = $token_info; $type = isset( $form['fields'][ $field_id ]['dynamic_choices'] ) ? $form['fields'][ $field_id ]['dynamic_choices'] : null; // Return blank string if type is not set. if ( empty( $type ) ) { return ''; } $choices = array_map( 'trim', explode( ',', $entry_choice ) ); $labels = array(); foreach ( $choices as $choice ) { // Handle post types. if ( 'post_type' === $type ) { $labels[] = get_the_title( $choice ); } // Handle taxonomy. if ( 'taxonomy' === $type ) { $term = get_term( $choice ); $labels[] = isset( $term->name ) ? $term->name : ''; } } return implode( ', ', $labels ); }
Expand full source code Collapse full source code View on Github