User tests: Successful: Unsuccessful:
Im currently working on a plugin to extend the contact form and noticed that with the current implementation of the form layout, the standard fields e.g. name, email, subject, message, [...] are rendered statically, followed by an iteration over custom fieldsets (see default_form.php).
This way you cannot insert custom fields (via plugins) between the default fields without creating a template override for default_form.php.
With this pull request, a system and / or content plugin can override and / or extend the fields and their ordering while maintaining the normal behavior for custom fieldsets without the need to create a template override.
This would be the time where one has to create a template override to use custom fields in the default contact form. You could do either that or apply the patch to make the custom field show up in the form. Note: For this test, I included a field called: "Bazquirk" in the plugin.
I mentioned earlier that the default static output would result in custom fields being appended to the form, regardless in which fieldset you put the custom field. This is and still will be the normal behavior, even with this patch (bc).
To include a custom field at the position of your choice you can now "override" the order with a plugin. In our example, it can be done by uncommenting line ~51 of the contact.php file (test / demo plugin).
Before the patch, the custom field would be appended (if not manually added in the template override).
After the patch and in combination with "reset" from line ~51, the output of the fields will be in the order of how the fields are arranged in the form manifest that extends the form.
Note: Make sure to delete the template override if you created one. Another way to test it would be to use the changed file of this pull request as the template override.
Status | New | ⇒ | Pending |
Labels |
Added:
?
|
Category | ⇒ | Administration Plugins |
Easy | No | ⇒ | Yes |
Yeah your right looking into it. Without the JFormField object being available in the JLayout it's just a nightmare. Just roll with this for now - it's better than what's there at the moment :)
Plugin and patch installed and both works as described.
Klappt
Edit: Please only English here!
After applying the patch and installing and activating the plugin I can see the form field “Bazquirk”. But I do not see the benefit of this. Where could I insert my own custom fields? Do I have to edit the contact.xml?
You have to build a custom plugin - like the custom user profile one. That's fine. RTC.
Status | Pending | ⇒ | Ready to Commit |
[Removed nonsense]
Labels |
Added:
?
|
I have tested this item successfully on 42ead20
If I understand this correctly, I can use this plugin and copy it to add additional fields - only of the Textbox variety?
As described it functions
Milestone |
Added: |
Thank you @matrikular and testers! Merged.
Status | Ready to Commit | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2015-10-24 13:15:06 |
Closed_By | ⇒ | Kubik-Rubik |
Labels |
Removed:
?
|
@coolman01 - you can modify this plugin to add any field to the contact form and position it to your liking. Remember that you will have to provide the email send functionality as well. Otherwise your custom fields won't be included in the email (don't forget to set "Custom Reply" in com_contact settings).
Milestone |
Milestone |
Added: |
Milestone |
Added: |
Milestone |
Category | Administration Plugins | ⇒ | Front End com_contact |
Title |
|
If it wasn't for the "optinal" language string that gets appended to non-required fields in the layout which forces us to do a component specific JLayout override, ... in principle we could. You could also just write <?php echo $field->renderField(); ?>
I found it a bit messy though to parse / seach?! for a / the required attribute for that field in the input string within $displayData. If that is an okay thing to do, that's fine with me then.