-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[4.0] ComponentHelper::getComponentName() returns wrong name in some cases #24414
Comments
@infograf768 can you please comment? |
A better person to ask would be @mbabker |
Closing this due to not receiving required information to determine if this is a bug or not. If you feel this still needs review, please open a new tracker entry with as much information as possible to ensure it can be reviewed properly |
@alikon what was the required information that was missing. |
Mar 30, 2019 and no action so what is the point ? |
Did anyone even take the time to attempt to reproduce the issue or understand what the code is currently doing to cause this bug report to be submitted in the first place? Or was everyone just hoping I might peak at it and answer and realize that 9 months later I never did and decided the item should go unactioned? |
it seems that my view on issues management it is far away from yours.... |
I can confirm this issue while migrating an own third-party component to the new structure of J4. This code only considers namespaces that contain the segment joomla-cms/libraries/src/Component/ComponentHelper.php Lines 480 to 493 in e893aab
Considering https://docs.joomla.org/J4.x:Namespace_Conventions_In_Joomla, this only applies to core components. The desired namespace structure for 3rd-party components is In my point of view, there are three options, every one with their own drawbacks:
IMO, the most versatile options would be 2. But as I just recently started migrating this component to J4, maybe someone else with more experience in J4 namespacing and similar things has a suggestion here? Respectively, if someone already migrated their component to J4 successfully, maybe you can post a solution here? |
I just reviewed the documentation from this page https://docs.joomla.org/J4.x:Namespace_Conventions_In_Joomla again, the namespace for third party extensions has been updated to If you still have this issue, feel free to re-open. Thanks ! |
I run into an issue which results in making some problems and extra effort required to use the old element name of a component in J!4.
In an edit view of a component is no
$this->option
set by default. So the used \Joomla\CMS\MVC\Controller\FormController is usingComponentHelper::getComponentName($this, $this->getName())
in it's constructor to get the element name for the url to redirect to the view.Now the 'problem' is that
getComponentName()
is usinggetNamespaceName()
which results in a different name than the real element name.Steps to reproduce the issue
Use a component named 'com_brand_component_name' (with underscores) and namespace 'BrandComponentName'. Click edit/new to go to an item.
Expected result
getComponentName()
returns 'com_brand_component_name'.You should end up on this link: 'index.php?option=com_brand_component_name&view=name&layout=edit'.
No 404 error.
Actual result
getComponentName()
returns 'com_brandcomponentname'.You will end up on this link: 'index.php?option=com_brandcomponent name&view=name&layout=edit'.
With message 404 – component not found.
System information (as much as possible)
Joomla 4.0 Alpha 8 Nightly, PHP 7.2
Additional comments
I am aware of that by setting
$this->option
in my view controller to 'com_brand_component_name' the issue is solvable.Just wondering whether or not this is an expected behavior or if it would be worth to think about to have a fallback for that special case to avoid setting the option hardcoded in every controller manually.
The text was updated successfully, but these errors were encountered: