am-impact / amforms

Forms plugin for Craft
Other
122 stars 21 forks source link

Added option to load custom fields #175

Open DHoogland opened 6 years ago

DHoogland commented 6 years ago

Added the option to load custom fields from external plugins. I use this my self to load a custom address field with address auto completion from the zip code/house number.

Add this function to your main plugin class to return your field(s):

    /**
     * @return array
     */
    public function amFormsCustomFields()
    {
        return ['FieldNameHere'];
    }
iemand002 commented 5 years ago

I'm trying this in a project of mine and it works until it wants to get the $input on line 400 in AmForms_FormsService as it is searching for the template in the amforms plugin. How did you manage to work around that?

DHoogland commented 5 years ago

I made this PR a while ago and don't have access to the repository anymore to check how I actually did that. I think it was something with the structure _amforms/field in your projects templates. Maybe @hubertprein or @FrankZwiers can confirm this?