[5.0] Joomla content plugin: Check if param is set before comparing #41500
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary of Changes
When adding a menu item to edit/creates articles, this code checks if the parameter
enable_category
is equal to 1 and if the catid is set. However, when you add this code not via the menu manager, but manually via some script, it will throw a notice when that parameter is not set. This PR adds a simple check if that param is present before comparing it. Since not setting this equals to 0, this should be fine.Testing Instructions
Right now, before #41489 is merged, the testing sampledata can not be run, because that parameter is missing. So, install Joomla and run the testing sampledata.
Actual result BEFORE applying this Pull Request
Adding the testing sampledata fails with a notice in the AJAX call.
Expected result AFTER applying this Pull Request
Now it 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:
No documentation changes for manual.joomla.org needed