joomla-cms
joomla-cms copied to clipboard
[5.x] Form control fields, new API
Summary of Changes
Replace control inputs hardcoded into the form layout with an API which allows to add this fields programaticaly.
Before PR (the form layout):
<input type="hidden" name="task" value="">
<input type="hidden" name="return" value="<?php echo $input->getBase64('return'); ?>">
<input type="hidden" name="forcedLanguage" value="<?php echo $input->get('forcedLanguage', '', 'cmd'); ?>">
<?php echo HTMLHelper::_('form.token'); ?>
After PR:
// In Controller/View
$this->form
->addControlField('task', '')
->addControlField('return', $input->getBase64('return', ''))
->addControlField('forcedLanguage', $forcedLanguage);
// In the form layout
echo $this->form->renderControlFields();
For now I have updated following forms:
- [x] Article
- [x] Category
- [x] Menu
Will update more, when there will be a positive feedbacks.
Testing Instructions
Code review. Create/edit Article, Category, Menu item. All should work as before.
Actual result BEFORE applying this Pull Request
Works
Expected result AFTER applying this Pull Request
Works
Link to documentations
Please select:
- [ ] Documentation link for docs.joomla.org:
- [ ] No documentation changes for docs.joomla.org needed
- [ ] Pull Request link for manual.joomla.org: TBD
- [ ] No documentation changes for manual.joomla.org needed
I have tested this item :white_check_mark: successfully on 5cfe9859447c404f584d05ab27185a902838fc7c
A long life in IT, I have learned that everything changes.
A wise controller, from Italy, whom I once met, said that we should remember that we did not invent solutions to problems that we did not have! Extra testing, modifying working code, and so on.
The code does as described, it is as such ok.
I miss a use case for this change. What is it that is being tried to solve? It could just be that I just haven't seen it.
This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/43857.
PS. testet on Wampserver install version 3.3.2 installed on 2024-04-03 Updated to 3.3.6 on 2024-08-04 MySQL 8.2.0 Port 3306 Apache 2.4.62 PHP 8.3.10 error_reporting = E_ALL Display Errors = on
With
2024-08-09 5.2 dev a9980fe5fcbb588c2ebfd4a398c1e0f2c453f5d0
This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/43857.
version a9980fe5fcbb588c2ebfd4a398c1e0f2c453f5d0
This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/43857.
It's weird that my text disappears or gets changed.
This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/43857.
I have tested this item :white_check_mark: successfully on c24da878b8877931fa3cf98843e97f7190ba21ff
Tested successfully
This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/43857.
I have tested this item :white_check_mark: successfully on c24da878b8877931fa3cf98843e97f7190ba21ff
I was able to test successfully :)
This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/43857.
RTC
This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/43857.
This pull request has been automatically rebased to 5.3-dev.
thanks, first step for form renderer