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
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_checkbox_labels( string $entry_choice = '', array $choices = array() )
Handles the token for checkbox fields.
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
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
- $entry_choice
(Optional) The selected value.
Default value: ''
- $choices
(Optional) The available choices.
Default value: array()
Return Return
(string) The selections
Source Source
File: src/integrations/wpforms/tokens/wpf-tokens.php
private function handle_checkbox_labels( $entry_choice = '', $choices = array() ) { $entry_choice_arr = explode( ', ', $entry_choice ); $choices_column = array_column( $choices, 'label' ); $selections = array(); foreach ( $choices_column as $index => $choice_column ) { // Strip whitespace for single space. $choice_column = preg_replace( '/\s+/', ' ', $choice_column ); if ( in_array( $choice_column, $entry_choice_arr, true ) ) { $selections[] = $choices_column[ $index ]; } } if ( ! empty( $selections ) ) { return implode( ', ', $selections ); } return ''; }
Expand full source code Collapse full source code View on Github