Comments (4)
@leofeyer @ausi any idea why this is happening?
from contao-node.
I guess this is caused by $nodeId = $dc->id;
on line 63 as $dc->id
refers to the ID of the content element and not the node.
from contao-node.
Yeah, this extension is not compatible with nested elements at the moment. Simple as that. I'll tag this as a feature because we'll have to introduce support for them, in whichever way we'll do that.
from contao-node.
This fix worked for me.
main...dennisbohn:contao-node:main
The ContentListener.php class contains an additional method to iterate through content elements.
private function findNodeIdByContentId($contentId): int
{
$pid = $contentId;
$ptable = 'tl_content';
// Recursive node id finder
while ($ptable === 'tl_content') {
list($pid, $ptable) = $this->db->fetchNumeric('SELECT pid, ptable FROM tl_content WHERE id=?', [$pid]);
}
return $pid;
}
The onLoadCallback method has been changed to the new method.
public function onLoadCallback(DataContainer $dc): void
{
switch (Input::get('act')) {
case 'edit':
case 'delete':
case 'show':
case 'copy':
case 'copyAll':
case 'cut':
case 'cutAll':
$nodeId = $this->findNodeIdByContentId($dc->id);
break;
case 'paste':
if ('create' === Input::get('mode')) {
$nodeId = $dc->id;
} else {
$nodeId = $this->findNodeIdByContentId($dc->id);
}
break;
case 'create':
// Nested element
if (Input::get('ptable') === 'tl_content') {
$nodeId = $this->findNodeIdByContentId(Input::get('pid'));
} else {
$nodeId = $dc->id;
}
break;
default:
// Ajax requests such as toggle
if (Input::get('field') && ($id = Input::get('cid') ?: Input::get('id'))) {
$nodeId = $this->findNodeIdByContentId($id);
// Nested element
} else if (Input::get('ptable') === 'tl_content') {
$nodeId = $this->findNodeIdByContentId($dc->id);
} else {
$nodeId = $dc->id;
}
break;
}
$type = $this->db->fetchOne('SELECT type FROM tl_node WHERE id=?', [$nodeId]);
// Throw an exception if the node is not present or is of a folder type
if (!$type || NodeModel::TYPE_FOLDER === $type) {
throw new AccessDeniedException('Node of folder type cannot have content elements');
}
$this->checkPermissions((int) $nodeId);
}
Create, copy, edit, delete, moving, info and toggle works fine inside and outside the element group. Nested element groups are also possible. But it feels that it needs some more testing. I'm not sure what all needs to be taken into account when it comes to ajax requests.
from contao-node.
Related Issues (20)
- Add more options HOT 5
- Non-existent service HOT 8
- TypeError if InsertTag is combined with ID of non-existent Node-Element HOT 5
- Internal Server Error HOT 4
- Internal Server Error HOT 1
- Seitenauswahl hinzufügen? HOT 4
- Missing German translation: Access protection HOT 1
- Error: Column not found: 1054 Unknown column 'tags' in 'field list' HOT 9
- Unable to hide content-element - Contao 4.13 RC2 HOT 7
- The folder nodes are not allowed HOT 1
- Vererbung der Node Mounts wird nicht berücksichtigt HOT 3
- Warning: Attempt to read property "nodes" on array HOT 1
- Contao 5.04: Non-existent service "session". HOT 4
- Attempted to load class "Table" from the global namespace. Did you forget a "use" statement? HOT 1
- Version 1.5.13 not installable in contao 4.13 HOT 5
- Benutzergruppenverwaltung HOT 1
- System update fails in Contao Manager HOT 1
- Contao 5.3 Fehler bei NodesPicker HOT 1
- Add IDs in overview and alias for insert tags
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from contao-node.