cf7-repeatable-fields icon indicating copy to clipboard operation
cf7-repeatable-fields copied to clipboard

Applied 'wpcf7_field_group_content' filter to HTML output

Open Tessachu opened this issue 11 months ago • 1 comments

Applied a filter so developers can potentially prepopulate with dynamic data. Example usage:

/**
 * Prepopulate Repeater Field
 *
 * @param string $default_html The full HTML content of the repeater group content.
 * @param string $group_name The field name representing the repeater group as set in the `field_group` form tag.
 * @param array $group An array of group data with keys for `tags` representing an array of scanned form tags and `raw` representing a string of raw HTML.
 *
 * @return string The full HTML content of the repeater group content.
 */
public function cf7_repeater_content($default_html, $group_name, $group)
{
    $prefilled_html = '';
    // Do stuff
    return $prefilled_content ? $prefilled_content : $default_html;
}```

Tessachu avatar Mar 19 '24 18:03 Tessachu

Thanks @Tessachu, but before I can merge the PR, can you please assign the result of the filter to a variable, add phpdocs, and also fix the indentation? Thanks!

felipeelia avatar Apr 28 '24 21:04 felipeelia