Closed saress closed 4 years ago
I can confirm the problem. The problematic code is this:
Under certain circumstances, CURRENT_ID
will be the ID
of a tl_content
entry, and not a tl_node
entry and thus !$node || NodeModel::TYPE_FOLDER === $node
will likely be true.
Not sure how to fix this though. May be check for null === Input::get('act')
or something?
Should be fixed in 1a3374a. It should make its way to the next minor version which should be released this week.
The problem should be fixed already in 1.1.1 ππ»
Nope, I'm sorry. I have 1.1.1 and I'm running into this problem :(
Can you tell me exactly how to reproduce it? These are my steps:
Hm, I can also reproduce the problem in 1.1.1
, though I my case I don't even have to open a link picker or anything. The error occurs when I go into an existing node and click on New element.
Contao\CoreBundle\Exception\AccessDeniedException:
Node of folder type cannot have content elements
at vendor\terminal42\contao-node\src\EventListener\ContentListener.php:59
at Terminal42\NodeBundle\EventListener\ContentListener->onLoadCallback(object(DC_Table))
(vendor\contao\core-bundle\src\Resources\contao\drivers\DC_Table.php:202)
at Contao\DC_Table->__construct('tl_content', array('tables' => array('tl_node', 'tl_content')))
(vendor\contao\core-bundle\src\Resources\contao\classes\Backend.php:401)
at Contao\Backend->getBackendModule('nodes', null)
(vendor\contao\core-bundle\src\Resources\contao\controllers\BackendMain.php:131)
at Contao\BackendMain->run()
(vendor\contao\core-bundle\src\Controller\BackendController.php:55)
at Contao\CoreBundle\Controller\BackendController->mainAction()
(vendor\symfony\symfony\src\Symfony\Component\HttpKernel\HttpKernel.php:151)
at Symfony\Component\HttpKernel\HttpKernel->handleRaw(object(Request), 1)
(vendor\symfony\symfony\src\Symfony\Component\HttpKernel\HttpKernel.php:68)
at Symfony\Component\HttpKernel\HttpKernel->handle(object(Request), 1, true)
(vendor\symfony\symfony\src\Symfony\Component\HttpKernel\Kernel.php:200)
at Symfony\Component\HttpKernel\Kernel->handle(object(Request))
(web\app_dev.php:68)
$type
is false
in this case. And $dc->id
is the ID of the node.
Everything works fine if I change it to this:
-if ($dc->table === 'tl_content' && Input::get('act')) {
+if ($dc->table === 'tl_content' && 'edit' === Input::get('act')) {
You're right @fritzmg, thanks for the input. I have just released 1.1.2 which should definitely close the case.
Unfortunately the same error still occurs with act=paste&mode=cut
(click on the icon to move a content element).
@fritzmg can you test 8d252f8 please?
@fritzmg can you test 8d252f8 please?
Unfortunately that will again produce the error, when you simply want to create an element π¬. It's frustrating working around these DCA/Contao back end convolutions, I know π
Hmm under what circumstances would it? I just tried to create a content element and it worked fine.
Hm, no special circumstances as far as I can tell. I have an existing node (which is a sub node of a parent folder node) with existing content elements. If I click on New element, the error occurs.
Contao\CoreBundle\Exception\AccessDeniedException:
Node of folder type cannot have content elements
at vendor\terminal42\contao-node\src\EventListener\ContentListener.php:59
at Terminal42\NodeBundle\EventListener\ContentListener->onLoadCallback(object(DC_Table))
(vendor\contao\core-bundle\src\Resources\contao\drivers\DC_Table.php:202)
at Contao\DC_Table->__construct('tl_content', array('tables' => array('tl_node', 'tl_content')))
(vendor\contao\core-bundle\src\Resources\contao\classes\Backend.php:401)
at Contao\Backend->getBackendModule('nodes', null)
(vendor\contao\core-bundle\src\Resources\contao\controllers\BackendMain.php:131)
at Contao\BackendMain->run()
(vendor\contao\core-bundle\src\Controller\BackendController.php:55)
at Contao\CoreBundle\Controller\BackendController->mainAction()
(vendor\symfony\symfony\src\Symfony\Component\HttpKernel\HttpKernel.php:151)
at Symfony\Component\HttpKernel\HttpKernel->handleRaw(object(Request), 1)
(vendor\symfony\symfony\src\Symfony\Component\HttpKernel\HttpKernel.php:68)
at Symfony\Component\HttpKernel\HttpKernel->handle(object(Request), 1, true)
(vendor\symfony\symfony\src\Symfony\Component\HttpKernel\Kernel.php:200)
at Symfony\Component\HttpKernel\Kernel->handle(object(Request))
(web\app_dev.php:68)
Variable/Expression | Content | Comment |
---|---|---|
$dc->table |
"tl_content" |
|
$dc->id |
"2" |
2 is the ID of the node |
Input::get('act') |
"paste" |
Link for New element:
β¦/contao?do=nodes&table=tl_content&id=2&act=paste&mode=create&rt=β¦&ref=β¦
Note: creating a new element with the (β) link works fine. Did you try with New element (Contao 4.4) / New (Contao 4.9)?
This is pure madnessβ¦ I tested 2fd899d and it seems to work, mind checking as well, please? π
This works - however, unfortunately I was able to move a content element into a node of type folder by manipulating the paste URL π¬
β¦/contao?do=nodes&table=tl_content&id=27990&act=cut&mode=2&pid=2&rt=β¦&ref=β¦
If you change the pid
of that URL to an ID of a folder node, then the AccessDeniedException
is not thrown.
@fritzmg break this one 6e52151 π
omg π too bad there is no easier way to do this..?
I'll test some time today.
Looks fine as far as I have tested π
1.1.3 has been released. @saress @coffeincode please update your systems.
I have a content node and inside there is a single text element with some content in it.
If I add a link to the text, everything works fine if I choose a "page" or a "file" with the picker. If I add a "news" element or an "event" element and save the content element, it will result to the error shown above. I guess it would be the same with a "faq" element.
The node it self is inside a node-folder, but it makes no difference if I move it outside a node folder. I have the latest contao-node version installed on a Contao 4.4.42 LTS.
Kind regards, Sares