Skip to content

Commit

Permalink
Add build-tools and fix code quality
Browse files Browse the repository at this point in the history
  • Loading branch information
aschempp committed Feb 15, 2024
1 parent 2224949 commit f6ea081
Show file tree
Hide file tree
Showing 44 changed files with 131 additions and 560 deletions.
11 changes: 2 additions & 9 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@
},
"require-dev": {
"terminal42/contao-geoip2-country": "^1.0",
"contao/manager-plugin": "^2.0"
"contao/manager-plugin": "^2.0",
"terminal42/contao-build-tools": "dev-main"
},
"suggest": {
"terminal42/contao-geoip2-country": "Protect nodes in Contao using MaxMind GeoIP2 database"
Expand All @@ -48,13 +49,5 @@
},
"extra": {
"contao-manager-plugin": "Terminal42\\NodeBundle\\ContaoManager\\Plugin"
},
"scripts": {
"cs-fixer": "tools/ecs/vendor/bin/ecs check src/ --fix --ansi"
},
"config": {
"allow-plugins": {
"ocramius/package-versions": true
}
}
}
2 changes: 1 addition & 1 deletion config/services.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ services:
public: false
arguments:
- "@database_connection"
- "@security.token_storage"
- "@security.helper"

terminal42_node.picker:
class: Terminal42\NodeBundle\Picker\NodePickerProvider
Expand Down
19 changes: 8 additions & 11 deletions contao/config/config.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
<?php

/*
* Node Bundle for Contao Open Source CMS.
*
* @copyright Copyright (c) 2019, terminal42 gmbh
* @author terminal42 <https://terminal42.ch>
* @license MIT
*/
use Terminal42\NodeBundle\ContentElement\NodesContentElement;
use Terminal42\NodeBundle\FrontendModule\NodesModule;
use Terminal42\NodeBundle\Model\NodeModel;
use Terminal42\NodeBundle\Widget\NodePickerWidget;

/*
* Backend modules
Expand All @@ -20,22 +17,22 @@
/*
* Back end form fields
*/
$GLOBALS['BE_FFL']['nodePicker'] = \Terminal42\NodeBundle\Widget\NodePickerWidget::class;
$GLOBALS['BE_FFL']['nodePicker'] = NodePickerWidget::class;

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

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

/*
* Models
*/
$GLOBALS['TL_MODELS']['tl_node'] = \Terminal42\NodeBundle\Model\NodeModel::class;
$GLOBALS['TL_MODELS']['tl_node'] = NodeModel::class;

/*
* Hooks
Expand Down
10 changes: 2 additions & 8 deletions contao/dca/tl_content.php
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
<?php

/*
* Node Bundle for Contao Open Source CMS.
*
* @copyright Copyright (c) 2019, terminal42 gmbh
* @author terminal42 <https://terminal42.ch>
* @license MIT
*/
use Contao\Input;

if ('nodes' === \Contao\Input::get('do')) {
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'];
Expand Down
13 changes: 4 additions & 9 deletions contao/dca/tl_module.php
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
<?php

/*
* Node Bundle for Contao Open Source CMS.
*
* @copyright Copyright (c) 2019, terminal42 gmbh
* @author terminal42 <https://terminal42.ch>
* @license MIT
*/
use Contao\Controller;
use Contao\System;

\Contao\Controller::loadDataContainer('tl_content');
\Contao\System::loadLanguageFile('tl_content');
Controller::loadDataContainer('tl_content');
System::loadLanguageFile('tl_content');

/*
* Palettes
Expand Down
22 changes: 8 additions & 14 deletions contao/dca/tl_node.php
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
<?php

/*
* Node Bundle for Contao Open Source CMS.
*
* @copyright Copyright (c) 2019, terminal42 gmbh
* @author terminal42 <https://terminal42.ch>
* @license MIT
*/
use Contao\Controller;
use Contao\DC_Table;
use Terminal42\NodeBundle\Model\NodeModel;

$GLOBALS['TL_DCA']['tl_node'] = [
// Config
'config' => [
'label' => &$GLOBALS['TL_LANG']['MOD']['nodes'][0],
'dataContainer' => \Contao\DC_Table::class,
'dataContainer' => DC_Table::class,
'ctable' => ['tl_content'],
'enableVersioning' => true,
'markAsCopy' => 'name',
Expand Down Expand Up @@ -146,8 +142,8 @@
'filter' => true,
'inputType' => 'select',
'options' => [
\Terminal42\NodeBundle\Model\NodeModel::TYPE_CONTENT,
\Terminal42\NodeBundle\Model\NodeModel::TYPE_FOLDER,
NodeModel::TYPE_CONTENT,
NodeModel::TYPE_FOLDER,
],
'reference' => &$GLOBALS['TL_LANG']['tl_node']['typeRef'],
'eval' => ['tl_class' => 'w50'],
Expand All @@ -163,9 +159,7 @@
'nodeTpl' => [
'exclude' => true,
'inputType' => 'select',
'options_callback' => static function () {
return Contao\Controller::getTemplateGroup('node_');
},
'options_callback' => static fn () => Controller::getTemplateGroup('node_'),
'eval' => ['includeBlankOption' => true, 'chosen' => true, 'tl_class' => 'w50'],
'sql' => ['type' => 'string', 'length' => 64, 'default' => ''],
],
Expand Down Expand Up @@ -205,7 +199,7 @@
'inputType' => 'checkbox',
'foreignKey' => 'tl_member_group.name',
'eval' => ['mandatory' => true, 'multiple' => true],
'sql' => "blob NULL",
'sql' => 'blob NULL',
'relation' => ['type' => 'hasMany', 'load' => 'lazy'],
],
'guests' => [
Expand Down
18 changes: 6 additions & 12 deletions contao/dca/tl_user.php
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
<?php

/*
* Node Bundle for Contao Open Source CMS.
*
* @copyright Copyright (c) 2019, terminal42 gmbh
* @author terminal42 <https://terminal42.ch>
* @license MIT
*/

use Contao\CoreBundle\DataContainer\PaletteManipulator;
use Terminal42\NodeBundle\PermissionChecker;

/*
* Palettes
Expand Down Expand Up @@ -37,11 +31,11 @@
'exclude' => true,
'inputType' => 'checkbox',
'options' => [
\Terminal42\NodeBundle\PermissionChecker::PERMISSION_CREATE,
\Terminal42\NodeBundle\PermissionChecker::PERMISSION_EDIT,
\Terminal42\NodeBundle\PermissionChecker::PERMISSION_DELETE,
\Terminal42\NodeBundle\PermissionChecker::PERMISSION_CONTENT,
\Terminal42\NodeBundle\PermissionChecker::PERMISSION_ROOT,
PermissionChecker::PERMISSION_CREATE,
PermissionChecker::PERMISSION_EDIT,
PermissionChecker::PERMISSION_DELETE,
PermissionChecker::PERMISSION_CONTENT,
PermissionChecker::PERMISSION_ROOT,
],
'reference' => &$GLOBALS['TL_LANG']['tl_user']['nodePermissionsRef'],
'eval' => ['multiple' => true, 'fieldType' => 'checkbox', 'tl_class' => 'clr'],
Expand Down
13 changes: 4 additions & 9 deletions contao/dca/tl_user_group.php
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@
<?php

/*
* Node Bundle for Contao Open Source CMS.
*
* @copyright Copyright (c) 2019, terminal42 gmbh
* @author terminal42 <https://terminal42.ch>
* @license MIT
*/

use Contao\Controller;
use Contao\CoreBundle\DataContainer\PaletteManipulator;
use Contao\System;

\Contao\Controller::loadDataContainer('tl_user');
\Contao\System::loadLanguageFile('tl_user');
Controller::loadDataContainer('tl_user');
System::loadLanguageFile('tl_user');

/*
* Palettes
Expand Down
8 changes: 0 additions & 8 deletions contao/languages/cs/default.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
<?php

/*
* Node Bundle for Contao Open Source CMS.
*
* @copyright Copyright (c) 2019, terminal42 gmbh
* @author terminal42 <https://terminal42.ch>
* @license MIT
*/

/*
* Content elements
*/
Expand Down
8 changes: 0 additions & 8 deletions contao/languages/cs/modules.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
<?php

/*
* Node Bundle for Contao Open Source CMS.
*
* @copyright Copyright (c) 2019, terminal42 gmbh
* @author terminal42 <https://terminal42.ch>
* @license MIT
*/

/*
* Backend modules
*/
Expand Down
7 changes: 0 additions & 7 deletions contao/languages/cs/tl_cfg_tag.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
<?php

/*
* Node Bundle for Contao Open Source CMS.
*
* @copyright Copyright (c) 2019, terminal42 gmbh
* @author terminal42 <https://terminal42.ch>
* @license MIT
*/

$GLOBALS['TL_LANG']['tl_cfg_tag']['sourceRef']['terminal42_node'] = 'Node';
8 changes: 0 additions & 8 deletions contao/languages/cs/tl_content.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
<?php

/*
* Node Bundle for Contao Open Source CMS.
*
* @copyright Copyright (c) 2019, terminal42 gmbh
* @author terminal42 <https://terminal42.ch>
* @license MIT
*/

$GLOBALS['TL_LANG']['tl_content']['nodes'] = ['Nodes', 'Vyberte jeden nebo více prvků.'];
$GLOBALS['TL_LANG']['tl_content']['nodesWrapper'] = ['Přidat wrapper', 'Tím bude přidán div kolem vybraného elementu.'];

12 changes: 3 additions & 9 deletions contao/languages/cs/tl_node.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
<?php

/*
* Node Bundle for Contao Open Source CMS.
*
* @copyright Copyright (c) 2019, terminal42 gmbh
* @author terminal42 <https://terminal42.ch>
* @license MIT
*/
use Terminal42\NodeBundle\Model\NodeModel;

$GLOBALS['TL_LANG']['tl_node']['name'] = ['Název', 'Zadejte prosím vlastní název tohoto prvku.'];
$GLOBALS['TL_LANG']['tl_node']['type'] = ['Typ', 'Zde můžete vybrat jeden z dostupných typů.'];
Expand All @@ -25,8 +19,8 @@
* Reference
*/
$GLOBALS['TL_LANG']['tl_node']['typeRef'] = [
\Terminal42\NodeBundle\Model\NodeModel::TYPE_CONTENT => 'Obsah',
\Terminal42\NodeBundle\Model\NodeModel::TYPE_FOLDER => 'Složka',
NodeModel::TYPE_CONTENT => 'Obsah',
NodeModel::TYPE_FOLDER => 'Složka',
];

/*
Expand Down
18 changes: 6 additions & 12 deletions contao/languages/cs/tl_user.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
<?php

/*
* Node Bundle for Contao Open Source CMS.
*
* @copyright Copyright (c) 2019, terminal42 gmbh
* @author terminal42 <https://terminal42.ch>
* @license MIT
*/
use Terminal42\NodeBundle\PermissionChecker;

$GLOBALS['TL_LANG']['tl_user']['nodeMounts'] = ['Nastavení přístupu', 'Zde můžete nastavit přístup k jednomu nebo více prvkům (Podprvky budou automaticky přidány).'];
$GLOBALS['TL_LANG']['tl_user']['nodePermissions'] = ['Přístupová práva', 'Zde můžete nastavit přístupová práva.'];
Expand All @@ -15,11 +9,11 @@
* Reference
*/
$GLOBALS['TL_LANG']['tl_user']['nodePermissionsRef'] = [
\Terminal42\NodeBundle\PermissionChecker::PERMISSION_CREATE => 'Vytvořit prvky',
\Terminal42\NodeBundle\PermissionChecker::PERMISSION_EDIT => 'Upravit prvky',
\Terminal42\NodeBundle\PermissionChecker::PERMISSION_DELETE => 'Smazat prvky',
\Terminal42\NodeBundle\PermissionChecker::PERMISSION_CONTENT => 'Spravovat prvky',
\Terminal42\NodeBundle\PermissionChecker::PERMISSION_ROOT => 'Spravovat klíčové prvky',
PermissionChecker::PERMISSION_CREATE => 'Vytvořit prvky',
PermissionChecker::PERMISSION_EDIT => 'Upravit prvky',
PermissionChecker::PERMISSION_DELETE => 'Smazat prvky',
PermissionChecker::PERMISSION_CONTENT => 'Spravovat prvky',
PermissionChecker::PERMISSION_ROOT => 'Spravovat klíčové prvky',
];

/*
Expand Down
10 changes: 2 additions & 8 deletions contao/languages/cs/tl_user_group.php
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
<?php

/*
* Node Bundle for Contao Open Source CMS.
*
* @copyright Copyright (c) 2019, terminal42 gmbh
* @author terminal42 <https://terminal42.ch>
* @license MIT
*/
use Contao\System;

\Contao\System::loadLanguageFile('tl_user_group');
System::loadLanguageFile('tl_user_group');

/*
* Legends
Expand Down
8 changes: 0 additions & 8 deletions contao/languages/de/default.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
<?php

/*
* Node Bundle for Contao Open Source CMS.
*
* @copyright Copyright (c) 2019, terminal42 gmbh
* @author terminal42 <https://terminal42.ch>
* @license MIT
*/

/*
* Content elements
*/
Expand Down
8 changes: 0 additions & 8 deletions contao/languages/de/modules.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
<?php

/*
* Node Bundle for Contao Open Source CMS.
*
* @copyright Copyright (c) 2019, terminal42 gmbh
* @author terminal42 <https://terminal42.ch>
* @license MIT
*/

/*
* Backend modules
*/
Expand Down
7 changes: 0 additions & 7 deletions contao/languages/de/tl_cfg_tag.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
<?php

/*
* Node Bundle for Contao Open Source CMS.
*
* @copyright Copyright (c) 2019, terminal42 gmbh
* @author terminal42 <https://terminal42.ch>
* @license MIT
*/

$GLOBALS['TL_LANG']['tl_cfg_tag']['sourceRef']['terminal42_node'] = 'Node';
Loading

0 comments on commit f6ea081

Please sign in to comment.