Create a plugin to handle onExtensionBeforeSave and onExtensionAfterSave. Put in diagnostics based on Joomla\CMS\Component\ComponentHelper::getParams() to show or save one of the option values. Change the option value and save. Note that both of the plugin methods show the old value, even though the new value is in the database.
The new value for the option should appear in the result returned by Joomla\CMS\Component\ComponentHelper::getParams()
The old value is returned by Joomla\CMS\Component\ComponentHelper::getParams()
Logical problem, will occur in any system.
This very much reduces the usefulness of the plugin hooks since there is no way to detect what has happened in the onExtensionAfterSave code.
Labels |
Removed:
?
|
Labels |
Added:
No Code Attached Yet
|
Does the second parameter in the event not have the new value? It should, then you can use that one and go from there. Better than relying on an external function. Not sure about the consequences when this functionality changes, as it exists since 8 years.
Labels |
Added:
bug
|
Status | New | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2024-09-25 18:47:22 |
Closed_By | ⇒ | Hackwar |
Hello @counterpoint, sorry that this took so long. I understand what you are trying to do, however I disagree that this is a bug and we wont be fixing this. Yes, the data in ComponentHelper::getParams() is not updated during the request when the component parameters are updated in the database. However it is expected that this isn't necessary. If your extension updates the component params and needs to access them afterwards, the expectation would be that your extension also updates the value in ComponentHelper::getParams(). You can do so by simply updating the value(s) in the registry object returned by getParams(). You can also compare the old value from ComponentHelper::getParams() with what is saved in the database in the events you mentioned above.
So to summarise: If you need to edit the configuration and have the result of ComponentHelper::getParams() updated in the same request, then you have to take care of that yourself. We are not going to update this in the system. Because of this, I'm closing this issue.
Spam removed.