-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added warning when database rows missing, fixes some deprecations
- Loading branch information
Showing
9 changed files
with
106 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
<?php | ||
|
||
namespace HeimrichHannot\SubColumnsBootstrapBundle\DataContainer; | ||
|
||
use Contao\Config; | ||
use Contao\CoreBundle\Routing\ScopeMatcher; | ||
use Contao\Input; | ||
use Contao\Message; | ||
use Doctrine\DBAL\Connection; | ||
use HeimrichHannot\UtilsBundle\Util\Utils; | ||
use Symfony\Component\HttpFoundation\RequestStack; | ||
|
||
class ColumnsetContainer | ||
{ | ||
/** | ||
* @var Connection | ||
*/ | ||
private $connection; | ||
/** | ||
* @var RequestStack | ||
*/ | ||
private $requestStack; | ||
/** | ||
* @var ScopeMatcher | ||
*/ | ||
private $scopeMatcher; | ||
|
||
public function __construct(Connection $connection, RequestStack $requestStack, ScopeMatcher $scopeMatcher) | ||
{ | ||
$this->connection = $connection; | ||
$this->requestStack = $requestStack; | ||
$this->scopeMatcher = $scopeMatcher; | ||
} | ||
|
||
|
||
public function onLoadCallback($dc): void | ||
{ | ||
$request = $this->requestStack->getCurrentRequest(); | ||
if (!$request || !$this->scopeMatcher->isBackendRequest($request) || 'edit' !== $request->get('act')) { | ||
return; | ||
} | ||
|
||
$sizes = $GLOBALS['TL_SUBCL'][Config::get('subcolumns')]['sizes'] ?? null; | ||
if (!$sizes) { | ||
return; | ||
} | ||
|
||
$tableColumns = $this->connection->getSchemaManager()->listTableColumns('tl_columnset'); | ||
|
||
foreach ($sizes as $size) | ||
{ | ||
if (!array_key_exists('columnset_'.strtolower($size), $tableColumns)) { | ||
Message::addError($GLOBALS['TL_LANG']['ERR']['huhSubColMissingTableRow']); | ||
return; | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
services: | ||
_defaults: | ||
autowire: true | ||
autoconfigure: true | ||
|
||
HeimrichHannot\SubColumnsBootstrapBundle\: | ||
resource: '../../{DataContainer}/*' | ||
public: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,11 @@ | ||
<?php | ||
|
||
$GLOBALS['TL_LANG']['CTE']['colsetPart'][0] = 'Spaltenset Trennelement'; | ||
/* | ||
* Content Elements | ||
*/ | ||
$GLOBALS['TL_LANG']['CTE']['colsetPart'][0] = 'Spaltenset Trennelement'; | ||
|
||
/* | ||
* Errors | ||
*/ | ||
$GLOBALS['TL_LANG']['ERR']['huhSubColMissingTableRow'] = 'Scheinbar wurde nach der Änderungen Subcolumns-Konfiguration die Datenbank noch nicht geupdated. Dies kann zu Fehlern beim Speichern der Konfiguration führen. Bitte updaten Sie die Datenbank, bevor Sie weitermachen.'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,11 @@ | ||
<?php | ||
|
||
/* | ||
* Content Elements | ||
*/ | ||
$GLOBALS['TL_LANG']['CTE']['colsetPart'][0] = 'Columnset divider element'; | ||
|
||
/* | ||
* Errors | ||
*/ | ||
$GLOBALS['TL_LANG']['ERR']['huhSubColMissingTableRow'] = 'The database seems to be not updated after changing the subcolumns configuration. This may lead to errors on saving. Please update the database before continuing.'; |