Habari\FormUI::dupe PHP Method

dupe() public method

Produce a form "duplicate" that does not process the form, display output, or include one-time-javascripts
public dupe ( Theme $theme = null ) : string
$theme Theme The theme to render the controls into
return string HTML form generated from all controls assigned to this form
    public function dupe(Theme $theme = null)
    {
        static $dupe_count = 0;
        $dupe_count++;
        $this->settings['is_dupe'] = true;
        $this->settings['id_prefix'] = 'dupe_' . $dupe_count . '_';
        $this->each(function (FormControl $control) use($dupe_count) {
            $control->settings['id_prefix'] = 'dupe_' . $dupe_count . '_';
        });
        $result = $this->get($theme);
        $this->each(function (FormControl $control) use($dupe_count) {
            unset($control->settings['id_prefix']);
        });
        $this->settings['id_prefix'] = '';
        $this->settings['is_dupe'] = false;
        return $result;
    }