? Pending

User tests: Successful: Unsuccessful:

avatar matrikular
matrikular
13 Oct 2015

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.

Test instructions:

  • Install the rudimentary test / demo plugin and activate it
  • Create a contact item
  • Create a link to that contact item in a menu of your choice (doesn't need to be assigned to an existing user)
  • Navigate to that link and make sure to open the form tab / slide if it is not visible / selected by default

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.

avatar matrikular matrikular - open - 13 Oct 2015
avatar matrikular matrikular - change - 13 Oct 2015
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 13 Oct 2015
Labels Added: ?
avatar zero-24 zero-24 - change - 13 Oct 2015
Category Administration Plugins
avatar zero-24 zero-24 - change - 13 Oct 2015
Easy No Yes
avatar matrikular
matrikular - comment - 13 Oct 2015

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.

avatar wilsonge
wilsonge - comment - 14 Oct 2015

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 :)

avatar bembelimen
bembelimen - comment - 24 Oct 2015

@test works as described
But I would also like to see ->renderField

avatar Bloggerschmidt
Bloggerschmidt - comment - 24 Oct 2015

Plugin and patch installed and both works as described.

avatar widmann-it
widmann-it - comment - 24 Oct 2015

Klappt

Edit: Please only English here!

avatar astridx
astridx - comment - 24 Oct 2015

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?

avatar wilsonge
wilsonge - comment - 24 Oct 2015

You have to build a custom plugin - like the custom user profile one. That's fine. RTC.

avatar wilsonge wilsonge - change - 24 Oct 2015
Status Pending Ready to Commit
avatar bertmert
bertmert - comment - 24 Oct 2015

[Removed nonsense]

avatar joomla-cms-bot joomla-cms-bot - change - 24 Oct 2015
Labels Added: ?
avatar coolman01 coolman01 - test_item - 24 Oct 2015 - Tested successfully
avatar coolman01
coolman01 - comment - 24 Oct 2015

I have tested this item :white_check_mark: 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


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/8085.

avatar Kubik-Rubik Kubik-Rubik - change - 24 Oct 2015
Milestone Added:
avatar Kubik-Rubik
Kubik-Rubik - comment - 24 Oct 2015

Thank you @matrikular and testers! Merged.

avatar Kubik-Rubik Kubik-Rubik - change - 24 Oct 2015
Status Ready to Commit Closed
Closed_Date 0000-00-00 00:00:00 2015-10-24 13:15:06
Closed_By Kubik-Rubik
avatar Kubik-Rubik Kubik-Rubik - close - 24 Oct 2015
avatar joomla-cms-bot joomla-cms-bot - close - 24 Oct 2015
avatar Kubik-Rubik Kubik-Rubik - reference | 1bd754b - 24 Oct 15
avatar Kubik-Rubik Kubik-Rubik - merge - 24 Oct 2015
avatar Kubik-Rubik Kubik-Rubik - close - 24 Oct 2015
avatar joomla-cms-bot joomla-cms-bot - change - 24 Oct 2015
Labels Removed: ?
avatar matrikular
matrikular - comment - 24 Oct 2015

@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).

avatar zero-24 zero-24 - change - 28 Oct 2015
Milestone
avatar zero-24 zero-24 - change - 28 Oct 2015
Milestone Added:
avatar zero-24 zero-24 - change - 28 Oct 2015
Milestone Added:
avatar zero-24 zero-24 - change - 28 Oct 2015
Milestone
avatar joomla-cms-bot joomla-cms-bot - change - 31 Jul 2017
Category Administration Plugins Front End com_contact
avatar matrikular matrikular - change - 31 Jul 2017
Title
Update contact form layout in favour of extending the form via plugins
Update contact form layout in favor of extending the form via plugins
avatar matrikular matrikular - edited - 31 Jul 2017

Add a Comment

Login with GitHub to post a comment