Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save nkb-bd/b23dfd1ca54be75526c3c8d39d9e6414 to your computer and use it in GitHub Desktop.
Save nkb-bd/b23dfd1ca54be75526c3c8d39d9e6414 to your computer and use it in GitHub Desktop.
<?php
add_filter('fluentform_form_settings_smartcodes', function ($groups) {
$groups[0]['shortcodes']['{adrian_all_data}'] = 'Custom All Data';
return $groups;
});
add_filter('fluentform_shortcode_parser_callback_adrian_all_data', function ($return, $instance) {
$form = $instance::getForm();
$entry = $instance::getEntry();
$formFields = \FluentForm\App\Modules\Form\FormFieldsParser::getEntryInputs($form);
$inputLabels = \FluentForm\App\Modules\Form\FormFieldsParser::getAdminLabels($form, $formFields);
$response = \FluentForm\App\Modules\Form\FormDataParser::parseFormSubmission($entry, $form, $formFields, true);
$html = '<table class="ff_all_data" width="600" cellpadding="0" cellspacing="0"><tbody>';
foreach ($inputLabels as $key => $label) {
if (!empty($response->user_inputs[$key])) {
$data = $response->user_inputs[$key];
if (is_array($data) || is_object($data)) {
continue;
}
$html .= '<tr class="field-label"><th style="padding: 6px 12px; background-color: #f8f8f8; text-align: left;"><strong>' . $label . '</strong></th></tr><tr class="field-value"><td style="padding: 6px 12px 12px 12px;">' . $data . '</td></tr>';
}
}
// you can add your own <tr> <td>
$html .= '</tbody></table>';
return $html;
}, 10, 2);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment