[4.1] Fix Deprecated warning for Calendar Form Field#37373
[4.1] Fix Deprecated warning for Calendar Form Field#37373rdeutz merged 6 commits intojoomla:4.1-devfrom
Conversation
|
I would love to see a way, that extensions can define a filter format (not sure why it has that name) in the XML. Can you add that @joomdonation? |
|
Yes, in second PR #37376 (via filterformat attribute). For this PR, I want to have safe fix which can go into 4.1. It prevent deprecated warnings for calendar form fields use in core. |
|
I will see if I can make a pr for 4.1 which will also work for extensions based on this one as I have a bad feeling shipping core for the next months with no way for extension developers to use a core field without a warning on PHP 8.1. |
|
I have tested this item ✅ successfully on ce908fe This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/37373. |
@laoneo All we need to do is add one more line of code to this PR: $this->filterFormat = (string) $this->element['filterformat'] ? (string) $this->element['filterformat'] : '';Then extension developers can just add |
|
I don't see this as an issue not to get merged into 4.1 as the benefit is high enough to have a clean way. For 4.2 we can then even deprecate the old format attribute. What I was thinking of is that the name filterformat is a bit strange. |
We use that format in calendar javascript code, so it could not be deprecated
Yes, agree. I guess it is named like that because the format is used in filter method of the field https://github.com/joomla/joomla-cms/blob/4.1-dev/libraries/src/Form/Field/CalendarField.php#L358-L361. |
|
I have tested this item 🔴 unsuccessfully on ce908fe But I can it reproduce only in custom extension https://github.com/exstreme/Jcomments-4/releases by editing any comment This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/37373. |
|
@exstreme As mentioned, this PR only fixes the issue for calendar form fields use in Joomla core (which has translateformat="true" in the field definition). For calendar form fields use by third party extension, more change is needed, one possible solution could be #37373 (comment) . However, that needs to be a new PR for 4.2. For this PR, I only made small change, not introduce a new thing so that it could be merged into 4.1. |
|
I have tested this item ✅ successfully on ce908fe This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/37373. |
|
RTC This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/37373. |
|
Puh, I see what you did there and it's the most painless solution without rewriting everything I guess but as you stated also not a full solution. |
|
@bembelimen I also made a PR #37376 for 4.2 which could be the full solution. The purpose of this PR is prevent warnings for Calendar fields use in Joomla core and I think it should be merged for 4.1 |
Deprecated: Function strftime() is deprecated and comes up in PHP8.1. Its a problem here: joomla/joomla-cms#37373
* Update item.xml Deprecated: Function strftime() is deprecated and comes up in PHP8.1. Its a problem here: joomla/joomla-cms#37373 * Update user.xml Update user.xml to prevent depreciated notice
Pull Request for Issue # .
Summary of Changes
This PR fixes deprecated warning for Calendar form field (use in core which all has
translateformat="true"in it's form field definition). For calendar form field does not havetranslateformat="true", we need a different PR. I think this is safe to go in 4.1 to prevent warnings like this in core.Testing Instructions
Actual result BEFORE applying this Pull Request
You would see some deprecated warnings like:
Expected result AFTER applying this Pull Request
No deprecated warning anymore, the date time you select for Start Publishing, Finish Start Publishing... are being saved properly.
Documentation Changes Required
None