In a custom Joomla component, define a field in the admin form like so:
<fieldset name="modulepositionset" label="Select Module Position"
addfieldpath="administrator/components/com_modules/models/fields">
<field name="moduleposition"
type="moduleposition"
label="Select Position"
description="Choose a module position." />
</fieldset>
Navigate to the admin backend and open the form.
Click the "Select Position" button rendered by the moduleposition
field.
Observe the error.
com_modules
, particularly in custom components.An error modal appears with the message:
COM_MODULES_CHANGE_POSITION_BUTTON
An error has occurred.
The URL of the modal includes an invalid or non-existent view:
index.php?option=com_modules&view=positions&layout=modal&tmpl=component&function=jSelectPosition_
When you remove &view=positions
, the modal loads successfully:
index.php?option=com_modules&layout=modal&tmpl=component&function=jSelectPosition_
moduleposition
field is tightly coupled with com_modules
, making it unusable in custom components.view=positions
, which doesn't resolve outside of com_modules
.&view=positions
from the URL allows the modal to load correctly.com_modules
.Labels |
Added:
No Code Attached Yet
|
The field should work outside com_modules, particularly in custom components.
Why should a field that you are specifically loading from "administrator/components/com_modules/models/fields" work elsewhere?
The field type in com_modules is
modulesPosition
('modules' in plural and 'P' is uppercase) . If you want to use this one, the field should be defined like this. (Although this still missing language text.)With this xml, the field will look like:
Also confirmed the issue is happened in
Joomla\CMS\Form\Field\ModulepositionField
.