Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
b7fefe3
Rewrite for Contao 5.3
qzminski Sep 12, 2025
8d7717d
Various fixes and improvements
qzminski Sep 15, 2025
6122a10
Fix the incomplete relation for tl_node.groups
qzminski Oct 9, 2025
3717176
Add support for nested elements (closes #51)
qzminski Oct 9, 2025
73b3e44
Fix the insert tags
qzminski Oct 9, 2025
0889860
Add the support for aliases (closes #52)
qzminski Oct 9, 2025
58f1231
Update the README
qzminski Oct 9, 2025
a2edfca
Fix the permissions
qzminski Oct 9, 2025
0f89cd9
Update contao/languages/de/tl_node.php
qzminski Oct 28, 2025
5a081a4
Do not nest the templates in /_new/ folder
qzminski Oct 28, 2025
4fd36c9
Do not autowire services using attributes
qzminski Oct 28, 2025
86bec80
Pass on extra data such as content element data to the node template …
qzminski Oct 28, 2025
640f36e
Drop FrontendTemplate in favor of direct Twig rendering
qzminski Oct 28, 2025
f08294a
Move the content elements inside folder check to the voter
qzminski Oct 28, 2025
3001711
CS
qzminski Oct 28, 2025
8b2bdf1
Fix rendering the nodes with wrappers
qzminski Oct 28, 2025
282067a
Run Rector + CS
qzminski Oct 28, 2025
b2952d1
Do not autowire services
qzminski Oct 28, 2025
11c67b7
Do not autowire services
qzminski Oct 28, 2025
56b7a5e
Improve sorting of multiple generated nodes
qzminski Oct 28, 2025
07cddba
Add a phpDoc
qzminski Oct 28, 2025
c51f9bb
CS
qzminski Oct 28, 2025
b59441c
PHPStan
qzminski Nov 7, 2025
b1e42ce
Dependency check
qzminski Nov 7, 2025
5afbb12
Update src/Security/Voter/NodePermissionVoter.php
qzminski Nov 7, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,4 @@ codefog_tags:

## Insert Tags

The extension also provides two new insert tags: `{{insert_node::*}}` and `{{insert_nodes::*}}`. The former expects the ID of a node and will then generate the output of that node. The latter expects a comma separated list of node IDs and will then generate the output of all those nodes. Example: `{{insert_nodes::1,2,3}}`
The extension also provides two new insert tags: `{{insert_node::*}}` and `{{insert_nodes::*}}`. The former expects the ID of a node and will then generate the output of that node. The latter expects a comma separated list of node IDs or aliases and will then generate the output of all those nodes. Example: `{{insert_nodes::1,2,3}}`
2 changes: 0 additions & 2 deletions composer-dependency-analyser.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,4 @@
return (new Configuration())
// Optional integrations
->ignoreErrorsOnPackage('terminal42/contao-geoip2-country', [ErrorType::DEV_DEPENDENCY_IN_PROD])

->ignoreUnknownClasses(['Haste\Model\Model'])
;
14 changes: 9 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,21 @@
"source": "https://github.com/terminal42/contao-node"
},
"require": {
"php": "^8.0",
"contao/core-bundle": "^4.13 || ^5.0",
"codefog/contao-haste": "^4.21 || ^5.0",
"php": "^8.1",
"contao/core-bundle": "^5.3",
"codefog/contao-haste": "^5.2",
"codefog/tags-bundle": "^3.3",
"doctrine/dbal": "^3.3 || ^4.0",
"doctrine/dbal": "^3.3 || ^4.3",
"psr/log": "^1.0 || ^2.0 || ^3.0",
"symfony/config": "^5.0 || ^6.0 || ^7.0",
"symfony/dependency-injection": "^5.0 || ^6.0 || ^7.0",
"symfony/http-foundation": "^5.0 || ^6.0 || ^7.0",
"symfony/http-kernel": "^5.0 || ^6.0 || ^7.0",
"symfony/security-core": "^5.0 || ^6.0 || ^7.0"
"symfony/security-core": "^5.0 || ^6.0 || ^7.0",
"symfony/security-bundle": "^5.0 || ^6.0 || ^7.0",
"symfony/service-contracts": "^3.0",
"symfony/translation-contracts": "^3.0",
"twig/twig": "^3.0"
},
"require-dev": {
"terminal42/contao-geoip2-country": "^1.4",
Expand Down
24 changes: 24 additions & 0 deletions config/controllers.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php

declare(strict_types=1);

namespace Symfony\Component\DependencyInjection\Loader\Configurator;

use Terminal42\NodeBundle\Controller\ContentElement\NodesController as NodesContentElementController;
use Terminal42\NodeBundle\Controller\FrontendModule\NodesController as NodesFrontendModuleController;
use Terminal42\NodeBundle\NodeManager;

return static function (ContainerConfigurator $containerConfigurator): void {
$services = $containerConfigurator->services();
$services->defaults()->autoconfigure();

$services
->set(NodesContentElementController::class)
->arg('$nodeManager', service(NodeManager::class))
;

$services
->set(NodesFrontendModuleController::class)
->arg('$nodeManager', service(NodeManager::class))
;
};
30 changes: 30 additions & 0 deletions config/listeners.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php

declare(strict_types=1);

namespace Symfony\Component\DependencyInjection\Loader\Configurator;

use Terminal42\NodeBundle\EventListener\ContentListener;
use Terminal42\NodeBundle\EventListener\DataContainerListener;

return static function (ContainerConfigurator $containerConfigurator): void {
$services = $containerConfigurator->services();
$services->defaults()->autoconfigure();

$services
->set(DataContainerListener::class)
->arg('$connection', service('database_connection'))
->arg('$finderFactory', service('contao.twig.finder_factory'))
->arg('$locales', service('contao.intl.locales'))
->arg('$logger', service('monolog.logger.contao'))
->arg('$requestStack', service('request_stack'))
->arg('$security', service('security.helper'))
->arg('$tagsManager', service('codefog_tags.manager.terminal42_node'))
->arg('$translator', service('translator'))
;

$services
->set(ContentListener::class)
->arg('$connection', service('database_connection'))
;
};
17 changes: 17 additions & 0 deletions config/migrations.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php

declare(strict_types=1);

namespace Symfony\Component\DependencyInjection\Loader\Configurator;

use Terminal42\NodeBundle\Migration\GuestsMigration;

return static function (ContainerConfigurator $containerConfigurator): void {
$services = $containerConfigurator->services();
$services->defaults()->autoconfigure();

$services
->set(GuestsMigration::class)
->arg('$connection', service('database_connection'))
;
};
33 changes: 33 additions & 0 deletions config/security.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php

declare(strict_types=1);

namespace Symfony\Component\DependencyInjection\Loader\Configurator;

use Terminal42\NodeBundle\Security\Voter\BackendAccessVoter;
use Terminal42\NodeBundle\Security\Voter\NodeContentVoter;
use Terminal42\NodeBundle\Security\Voter\NodePermissionVoter;

return static function (ContainerConfigurator $containerConfigurator): void {
$services = $containerConfigurator->services();
$services->defaults()->autoconfigure();

$services
->set(BackendAccessVoter::class)
->decorate('contao.security.backend_access_voter')
->arg('$contaoFramework', service('contao.framework'))
->arg('$inner', service('.inner'))
;

$services
->set(NodeContentVoter::class)
->arg('$accessDecisionManager', service('security.access.decision_manager'))
->arg('$connection', service('database_connection'))
;

$services
->set(NodePermissionVoter::class)
->arg('$accessDecisionManager', service('security.access.decision_manager'))
->arg('$contaoFramework', service('contao.framework'))
;
};
32 changes: 32 additions & 0 deletions config/services.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php

declare(strict_types=1);

namespace Symfony\Component\DependencyInjection\Loader\Configurator;

use Terminal42\NodeBundle\InsertTag\NodeInsertTag;
use Terminal42\NodeBundle\NodeManager;
use Terminal42\NodeBundle\Picker\NodePickerProvider;

return static function (ContainerConfigurator $containerConfigurator): void {
$services = $containerConfigurator->services();
$services->defaults()->autoconfigure();

$services
->set(NodeInsertTag::class)
->arg('$manager', service(NodeManager::class))
->arg('$logger', service('monolog.logger.contao'))
;

$services
->set(NodeManager::class)
->arg('$twig', service('twig'))
;

$services
->set(NodePickerProvider::class)
->arg('$menuFactory', service('knp_menu.factory'))
->arg('$router', service('router'))
->arg('$translator', service('translator'))
;
};
49 changes: 0 additions & 49 deletions config/services.yml

This file was deleted.

34 changes: 4 additions & 30 deletions contao/config/config.php
Original file line number Diff line number Diff line change
@@ -1,47 +1,21 @@
<?php

use Terminal42\NodeBundle\ContentElement\NodesContentElement;
use Terminal42\NodeBundle\FrontendModule\NodesModule;
use Terminal42\NodeBundle\Model\NodeModel;
use Terminal42\NodeBundle\Widget\NodePickerWidget;

/*
* Backend modules
*/
// Backend modules
$GLOBALS['BE_MOD']['content']['nodes'] = [
'tables' => array_values(array_unique(array_merge(['tl_node', 'tl_content'], $GLOBALS['BE_MOD']['content']['article']['tables'] ?? []))),
'table' => &$GLOBALS['BE_MOD']['content']['article']['table'],
'list' => &$GLOBALS['BE_MOD']['content']['article']['list'],
];

/*
* Back end form fields
*/
// Back end form fields
$GLOBALS['BE_FFL']['nodePicker'] = NodePickerWidget::class;

/*
* Frontend modules
*/
$GLOBALS['FE_MOD']['miscellaneous']['nodes'] = NodesModule::class;

/*
* Content elements
*/
$GLOBALS['TL_CTE']['includes']['nodes'] = NodesContentElement::class;

/*
* Models
*/
// Models
$GLOBALS['TL_MODELS']['tl_node'] = NodeModel::class;

/*
* Hooks
*/
$GLOBALS['TL_HOOKS']['executePostActions'][] = ['terminal42_node.listener.data_container', 'onExecutePostActions'];
$GLOBALS['TL_HOOKS']['replaceInsertTags'][] = ['terminal42_node.listener.insert_tags', 'onReplace'];

/*
* User permissions
*/
// User permissions
$GLOBALS['TL_PERMISSIONS'][] = 'nodeMounts';
$GLOBALS['TL_PERMISSIONS'][] = 'nodePermissions';
27 changes: 6 additions & 21 deletions contao/dca/tl_content.php
Original file line number Diff line number Diff line change
@@ -1,39 +1,24 @@
<?php

use Contao\Input;
use Doctrine\DBAL\Types\Types;

if ('nodes' === Input::get('do')) {
$GLOBALS['TL_DCA']['tl_content']['config']['ptable'] = 'tl_node';
$GLOBALS['TL_DCA']['tl_content']['config']['onload_callback'][] = ['terminal42_node.listener.content', 'onLoadCallback'];
$GLOBALS['TL_DCA']['tl_content']['list']['sorting']['headerFields'] = ['pid', 'name', 'tstamp'];
}

/*
* Palettes
*/
// Palettes
$GLOBALS['TL_DCA']['tl_content']['palettes']['__selector__'][] = 'nodesWrapper';
$GLOBALS['TL_DCA']['tl_content']['palettes']['nodes'] = '{type_legend},type;{include_legend},nodes,nodesWrapper;{template_legend:hide},customTpl;{protected_legend:hide},protected;{expert_legend:hide},guests;{invisible_legend:hide},invisible,start,stop';
$GLOBALS['TL_DCA']['tl_content']['palettes']['nodes'] = '{type_legend},type;{include_legend},nodes,nodesWrapper;{template_legend:collapsed},customTpl;{protected_legend:collapsed},protected;{expert_legend:collapsed},guests;{invisible_legend:collapsed},invisible,start,stop';

$GLOBALS['TL_DCA']['tl_content']['subpalettes']['nodesWrapper'] = 'cssID';

/*
* Fields
*/
// Fields
$GLOBALS['TL_DCA']['tl_content']['fields']['nodes'] = [
'label' => &$GLOBALS['TL_LANG']['tl_content']['nodes'],
'exclude' => true,
'inputType' => 'nodePicker',
'eval' => ['mandatory' => true, 'multiple' => true, 'fieldType' => 'checkbox', 'tl_class' => 'clr'],
'sql' => ['type' => 'blob', 'notnull' => false],
'save_callback' => [
['terminal42_node.listener.content', 'onNodesSaveCallback'],
],
'sql' => ['type' => Types::BLOB, 'notnull' => false],
];

$GLOBALS['TL_DCA']['tl_content']['fields']['nodesWrapper'] = [
'label' => &$GLOBALS['TL_LANG']['tl_content']['nodesWrapper'],
'exclude' => true,
'inputType' => 'checkbox',
'eval' => ['submitOnChange' => true, 'tl_class' => 'clr'],
'sql' => ['type' => 'string', 'length' => 1, 'default' => ''],
'sql' => ['type' => Types::BOOLEAN, 'default' => false],
];
10 changes: 3 additions & 7 deletions contao/dca/tl_module.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,12 @@
Controller::loadDataContainer('tl_content');
System::loadLanguageFile('tl_content');

/*
* Palettes
*/
// Palettes
$GLOBALS['TL_DCA']['tl_module']['palettes']['__selector__'][] = 'nodesWrapper';
$GLOBALS['TL_DCA']['tl_module']['palettes']['nodes'] = '{title_legend},name,type;{include_legend},nodes,nodesWrapper;{template_legend:hide},customTpl;{protected_legend:hide},protected;{expert_legend:hide},guests';
$GLOBALS['TL_DCA']['tl_module']['palettes']['nodes'] = '{title_legend},name,type;{include_legend},nodes,nodesWrapper;{template_legend:collapsed},customTpl;{protected_legend:collapsed},protected;{expert_legend:collapsed},guests';

$GLOBALS['TL_DCA']['tl_module']['subpalettes']['nodesWrapper'] = &$GLOBALS['TL_DCA']['tl_content']['subpalettes']['nodesWrapper'];

/*
* Fields
*/
// Fields
$GLOBALS['TL_DCA']['tl_module']['fields']['nodes'] = &$GLOBALS['TL_DCA']['tl_content']['fields']['nodes'];
$GLOBALS['TL_DCA']['tl_module']['fields']['nodesWrapper'] = &$GLOBALS['TL_DCA']['tl_content']['fields']['nodesWrapper'];
Loading