In 3.x we currently build all forms manually. This means we must build the PHP code to display the form, validate input, and perform actions, and build all the HTML for the forms (which is basically all redundant code except for the names and field types). With a form builder, the backend would handle displaying, validating, potentially handling some actions, and building all the HTML from some rules and specifications in PHP.
A significant portion of phpBB's code can be removed and cleaned up if we had some form builder that used a simple API and was flexible enough that every element we use in a form (perhaps including the posting form) was available on any page just by specifying a different input type. This is just a guess, but I would expect at least a third of the HTML code used in phpBB is in forms that could be removed (possibly more).
This would make adding or altering forms extremely simple (no editing HTML) and also much more reliable (forms are unit tested and HTML output for forms will not differ in different areas of phpBB). Extensions could also very easily modify any form to add or alter variables without having any issues with board styles.
Symfony has a Forms system which we could probably use as the backend for this:
http://symfony.com/doc/master/book/forms.html
The most obvious drawbacks to this is that it will severely break any existing mods which alter the phpBB forms and that at lot of code will be changed to make the transition from old forms to a form builder for everything, but I do not think the first issue is too much of a concern due to the benefits that would be realized with a form builder and the latter is just a matter of someone doing it (I would be interested in doing it for 3.2) and someone reviewing it (which would not be too bad if broken up into many PRs).
Use a Form builder for all phpBB Forms
- EXreaction
- Registered User
- Posts: 1555
- Joined: Sat Sep 10, 2005 2:15 am
Re: Use a Form builder for all phpBB Forms
Well, I agree this would be a major plus to the current system, no doubt about it. However: it requires a lot of rewriting of existing code as you stated, making me think something like this would probably better fit in the 4.0 plans rather than in the 3.x plans.
Above message may contain errors in grammar, spelling or wrongly chosen words. This is because I'm not a native speaker. My apologies in advance.
- imkingdavid
- Registered User
- Posts: 1050
- Joined: Thu Jul 30, 2009 12:06 pm
Re: Use a Form builder for all phpBB Forms
I could support something like this being in 3.2 or 3.3.
- Pony99CA
- Registered User
- Posts: 986
- Joined: Sun Feb 08, 2009 2:35 am
- Location: Hollister, CA
- Contact:
Re: Use a Form builder for all phpBB Forms
Would there be an event (or events) for controlling forms (adding or deleting fields, changing the style, etc.)? If so, this sounds like a good idea; otherwise I'd say no.
Also, would forms with CAPTCHAs be supported (the registration page and the posting page if you're a guest) or would those forms have to use the old method? What about forms with Custom Profile Fields?
Steve
Also, would forms with CAPTCHAs be supported (the registration page and the posting page if you're a guest) or would those forms have to use the old method? What about forms with Custom Profile Fields?
Steve
Silicon Valley Pocket PC (http://www.svpocketpc.com)
Creator of manage_bots and spoof_user (ask me)
Need hosting for a small forum with full cPanel & MySQL access? Contact me or PM me.
Creator of manage_bots and spoof_user (ask me)
Need hosting for a small forum with full cPanel & MySQL access? Contact me or PM me.
Re: Use a Form builder for all phpBB Forms
+1. If we were to use symfony forms component we should probably also change over validation for forms to use the symfony validation component also?
Formerly known as Unknown Bliss
No unsolicited PMs please except for quotes.psoTFX wrote: I went with Olympus because as I said to the teams ... "It's been one hell of a hill to climb"
- EXreaction
- Registered User
- Posts: 1555
- Joined: Sat Sep 10, 2005 2:15 am
Re: Use a Form builder for all phpBB Forms
All forms could easily be modified via events with this.
The symfony validation should be used as well.
The symfony validation should be used as well.
Re: Use a Form builder for all phpBB Forms
Generally +1 - This is obviously a huge change and I don't think it needs to happen all at once. We should introduce the form system in 2 or 3 places, and then expand it to everywhere else over time.
Re: Use a Form builder for all phpBB Forms
+1naderman wrote:Generally +1 - This is obviously a huge change and I don't think it needs to happen all at once. We should introduce the form system in 2 or 3 places, and then expand it to everywhere else over time.
Formerly known as Unknown Bliss
No unsolicited PMs please except for quotes.psoTFX wrote: I went with Olympus because as I said to the teams ... "It's been one hell of a hill to climb"
- EXreaction
- Registered User
- Posts: 1555
- Joined: Sat Sep 10, 2005 2:15 am
Re: Use a Form builder for all phpBB Forms
I've been working on implementing Symfony Forms into phpBB: https://github.com/phpbb/phpbb/pull/1922
It's really quite fantastic; the only HTML needed to show the form is: {{form(form_name)}}
Some style work needs to be done on it so it fits into the phpBB theme, but it can be completely customised per form as well:
http://symfony.com/doc/2.3/book/forms.html
It's really quite fantastic; the only HTML needed to show the form is: {{form(form_name)}}
Some style work needs to be done on it so it fits into the phpBB theme, but it can be completely customised per form as well:
http://symfony.com/doc/2.3/book/forms.html
- wintstar
- Registered User
- Posts: 108
- Joined: Sun Dec 02, 2012 1:38 pm
- Location: Gießen /Hessen Germany
- Contact:
Re: Use a Form builder for all phpBB Forms
New install from here
ticket/12066
Fatal error: Class 'Symfony\Bridge\Twig\Form\TwigRendererEngine' not found in C:\xampp\htdocs\12066\phpbb\template\twig\twig.php on line 117
PHP Version 5.4.19
MySQL(i) 5.5.32
ticket/12066
Fatal error: Class 'Symfony\Bridge\Twig\Form\TwigRendererEngine' not found in C:\xampp\htdocs\12066\phpbb\template\twig\twig.php on line 117
PHP Version 5.4.19
MySQL(i) 5.5.32
Greeting Stephan