Alejandro Posted January 14, 2021 at 04:28 PM Share Posted January 14, 2021 at 04:28 PM Using a filter that intercepts the output of a controller action, it is possible to make replacements and modify that output before its shown on the page. Using this approach, you can change how the field group titles are shown on the page by replacing them with your own HTML. <?php Clickfwd\Hook\Filter::add('after_filter_output_listings_edit', 'jreviews_replace_form_group_titles'); Clickfwd\Hook\Filter::add('after_filter_output_listings__loadForm', 'jreviews_replace_form_group_titles'); function jreviews_replace_form_group_titles($output, $params) { // Listing editing returns HTML, while listing submit returns JSON $isHtmlOutput = $output[0] !== '{'; if ($isHtmlOutput) { $tmp = $output; } else { $output = json_decode($output, true); $tmp = $output['html']; } // Replace the "Hotel Info" field group legend tag with an HTML header $hotelHeader = <<<HTML <div class="fwd-bg-teal-600 fwd-rounded-t-lg fwd-text-white fwd-p-4"> <h3 class="fwd-font-bold fwd-text-2xl">Some Header</h3> <p class="fwd-text-base">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam sed ipsum a ipsum tincidunt cursus. Vivamus urna tortor, dictum vitae felis ac, luctus elementum ligula. Vivamus ultrices ac sapien in scelerisque.<p> </div> HTML; $tmp = str_replace('<legend>Hotel Info</legend>', $hotelHeader, $tmp); if ($isHtmlOutput) { return $tmp; } $output['html'] = $tmp; return json_encode($output); } Here's the gist https://gist.github.com/jreviews/cdf5cb44467007a766cfeae48471176d n00bster, JoshLewis, Justify and 3 others 3 3 Link to comment
hjames82 Posted January 14, 2021 at 04:49 PM Share Posted January 14, 2021 at 04:49 PM This section is only visible with a valid subscription. If you have a valid subscription, please login. Link to comment
Justify Posted January 16, 2021 at 12:21 PM Share Posted January 16, 2021 at 12:21 PM This section is only visible with a valid subscription. If you have a valid subscription, please login. Link to comment
Recommended Posts