User tests: Successful: Unsuccessful:
Pull Request for Issue # #23510 . (Second try :))
I deleted the !$prefix
condition from two if statements in the libraries/src/MVC/Factory/MVCFactory.php
class. I was looking really carefully. But I can not find a place where$prefix = 'site'
is correct if strpos($config['base_path'], '/administrator/')
is true
= if $config['base_path']
is set and contains the word '/administrator/'.
The condition !$prefix
prevents that $prefix = 'Administrator';
can be set. $prefix
is set in the line
$prefix = 'Site;.
With this patch, no error will appear any more.
See #23510
No
What still confuses me is the fact that not all menu items can be selected.
I seldom work with the front end editing. That's why I did not notice that a publisher in xtd-modal does not see all menu items, which he can click in the font end. But: That was the same with Joomla 3x. I just checked that. Or is there something missing here?
Status | New | ⇒ | Pending |
Category | ⇒ | Libraries |
Title |
|
Title |
|
@joomdonation Thank you for your comment.
I looked at it again. I am far away from properly understanding the MVCFactory
class. But I think that the functionality belongs here. The function is not only needed in com_content
. Each component may use a backend view in the frontend. That is why I think it is general and it belongs to the parent class
But: This special case must be specified in the child class. If we agree that in this case the variable $config['base_path']
is set, it would run properly. That's how it was in Joomla 3. But changes in Joomla 4 have caused that the variable $prefix
is set and that is why the line I changed in this PR did not work any more.
I think this is what @mbabker means here: #23530 (comment) with
which is a regression from 3.x where the components were smart enough to proxy frontend requests to the backend code
I see no reason why $prefix
needs to be checked in the if statement I changed.
There must be a reason for that check. I am unsure but from my quick look, with your change might break the case when we try to create a frontend model (in this case, we would pass 'Site' as the value for $prefix parameter)
Also, as I mentioned, we are having too much magic code to determine the $prefix base on base_path config value. That's why I think override createModel and createView method when it's needed would be better.
For this, we need someone with better experience to make decision.
It seems that the prefix must always be set in Joomla\CMS\MVC\Controller\BaseController::getView()
. Otherwise Joomla\CMS\MVC\Controller\BaseController::$views
ends up with prefix-less views, which causes conflicts.
Status | Pending | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2019-06-30 09:04:51 |
Closed_By | ⇒ | astridx |
I haven't had time to read and understand current MVC implementation but I think MVCFactory should not contains magic code like that. Maybe a better solution for this problem would be override createView and createModel method directly in DisplayController of com_content frontend, something like below code:
The same logic would be applied for view = article and layout = pagebreak