User tests: Successful: Unsuccessful:
Pull Request for Issue #38244
This PR fixes a few issues with the menu item field:
List Of Menu Items (menuitem)
Single Article
and select the new created articleAttempted to read property title on null
A warning Attempted to read property title on null
when menu item is not available
No warning is displayed and no link is displayed
None
Status | New | ⇒ | Pending |
Category | ⇒ | Front End Plugins |
For my education can you please explain the changes regarding use statements.
Previously I was told that if its used only once in the file then it should be
class PlgFieldsMenuitem extends \Joomla\Component\Fields\Administrator\Plugin\FieldsPlugin
and not
use Joomla\Component\Fields\Administrator\Plugin\FieldsPlugin;
class PlgFieldsMenuitem extends FieldsPlugin
But you have changed this in the file
I have tested this item
Sorry but this is not the correct fix.
The custom field should work the same as the standard fields see https://docs.joomla.org/Menuitem_form_field_type
As you can see I missed adding the published option and just used the default
published (optional) determines whether all menu items are listed or only published menu items. If state is '0' then all menu items will be listed. If state is '1' then only published menu items will be listed. You also can use comma separated values like '1,2'.
Removing the ability to select an unpublished menu item severely limits the usability of this field ie you can not create links in advance of publishing the menu item
I have tested this item
For my education can you please explain the changes regarding use statements.
For me you always add namespaces to the list of use statements, so you have a complete overview of the namespaces you include.
Previously I was told that if its used only once in the file then it should be
I am not aware of such rule nor do I understand why it should be that way. The only time you could use the full path is when you have a naming conflict but even then namespaces can be aliased. If it is a rule, then it should be reverted.
Sorry but this is not the correct fix.
Fine, I am going to revert the custom field and we can apply proper fixes and get it ready for 4.3.
There are over 50 instances of
class xxxxxx extends \JoomlaXXXXXXXXXXXXXX
in fact almost all of those are for field plugins just like this one
but if you want to change that and always use namespaces then that is fine by me but then dont you also need to remove
* @phpcs:disable PSR1.Classes.ClassDeclaration.MissingNamespace
Status | Pending | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2022-08-14 11:32:07 |
Closed_By | ⇒ | roland-d | |
Labels |
Added:
?
Maintainers Checked
|
The problem must be in the parent groupedlistfield and not here as if you are using the usergroup list field then the exact same testing instructions do not produce the error
actually I misread part of this and you missed it in my comment
I read it as this pr removed the ability to SELECT an unpublished menu item which is what I said was desired.
Removing the ability to select an unpublished menu item severely limits the usability of this field ie you can not create links in advance of publishing the menu item
I see now that the check is only for the output of the link
I have tested this item✅ successfully on a066d43
This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/38457.