diff --git a/.composer-require-checker.json b/.composer-require-checker.json index 53cf5c017..6250cab10 100644 --- a/.composer-require-checker.json +++ b/.composer-require-checker.json @@ -6,11 +6,6 @@ "Contao\\ManagerPlugin\\Bundle\\Config\\BundleConfig", "Contao\\ManagerPlugin\\Bundle\\Parser\\ParserInterface", "Contao\\ManagerPlugin\\Routing\\RoutingPluginInterface", - "Doctrine\\Bundle\\DoctrineBundle\\DoctrineBundle", - "Knp\\Menu\\FactoryInterface", - "Knp\\Menu\\ItemInterface", - "Symfony\\Bundle\\FrameworkBundle\\Translation\\Translator", - "Symfony\\Contracts\\Cache\\CacheInterface", - "tl_user_group" + "InspiredMinds\\ContaoFileUsage\\Result\\ResultInterface" ] } diff --git a/.phpcq.lock b/.phpcq.lock index 5a2d34c1f..c8607bd72 100644 --- a/.phpcq.lock +++ b/.phpcq.lock @@ -1 +1 @@ -{"plugins":{"phpunit":{"api-version":"1.0.0","version":"1.0.0.0","type":"php-file","url":"https://phpcq.github.io/repository/plugin/phpunit/phpunit-1.0.0.0.php","signature":null,"requirements":{"php":{"php":"^7.3 || ^8.0"},"tool":{"phpunit":"^6.0 || ^7.0 || ^8.0 || ^9.0"}},"checksum":{"type":"sha-512","value":"c73f15658e3ba62665f09492ec91c3a6a715760bfaa88473a987538439fff442540148e086e46a6aa18ce55a3ea2fbf76caaa581384cb84a38859fcc609ae7e4"},"tools":{"phpunit":{"version":"9.6.20","url":"https://phar.phpunit.de/phpunit-9.6.20.phar","requirements":{"php":{"php":">=7.3","ext-dom":"*","ext-json":"*","ext-libxml":"*","ext-mbstring":"*","ext-xml":"*","ext-xmlwriter":"*"}},"checksum":{"type":"sha-256","value":"4b49fdf48a3fdb5f4f4b5b18c43a542e75787edaf6a6ab39713f579d0a018210"},"signature":"https://phar.phpunit.de/phpunit-9.6.20.phar.asc"}},"composerLock":null},"psalm":{"api-version":"1.0.0","version":"1.2.0.0","type":"php-file","url":"https://phpcq.github.io/repository/plugin/psalm/psalm-1.2.0.0.php","signature":null,"requirements":{"php":{"php":"^7.4 || ^8.0","ext-dom":"*"},"tool":{"psalm":"^3.0 || ^4.0 || ^5.0"}},"checksum":{"type":"sha-512","value":"4a550c9226d7bca582d7c10bd87cce01190c96398936b1613421640c83df62ed1c6e0d44c1b39635414ea8cf4a892a6458d27590793238add24e7cb5547e6ffd"},"tools":{"psalm":{"version":"5.26.1","url":"https://github.com/vimeo/psalm/releases/download/5.26.1/psalm.phar","requirements":{"php":{"php":"^7.4 || ~8.0.0 || ~8.1.0 || ~8.2.0 || ~8.3.0","ext-SimpleXML":"*","ext-ctype":"*","ext-dom":"*","ext-json":"*","ext-libxml":"*","ext-mbstring":"*","ext-tokenizer":"*"}},"checksum":null,"signature":"https://github.com/vimeo/psalm/releases/download/5.26.1/psalm.phar.asc"}},"composerLock":null},"composer-require-checker":{"api-version":"1.0.0","version":"1.1.1.0","type":"php-file","url":"https://phpcq.github.io/repository/plugin/composer-require-checker/composer-require-checker-1.1.1.0.php","signature":null,"requirements":{"php":{"php":"^7.4 || ^8.0"},"tool":{"composer-require-checker":"^3.8 || ^4.0"}},"checksum":{"type":"sha-512","value":"d5415bddfe024c5749d894034583882aee4e5c3e1087815d9fdd81cb5e71630f631a0e35de0ff84b97fbbf738c16ece5f83bd8c00695913eb846aa6f04577dc2"},"tools":{"composer-require-checker":{"version":"4.12.0","url":"https://github.com/maglnet/ComposerRequireChecker/releases/download/4.12.0/composer-require-checker.phar","requirements":{"php":{"php":"~8.2.0 || ~8.3.0 || ~8.4.0","ext-phar":"*"}},"checksum":null,"signature":"https://github.com/maglnet/ComposerRequireChecker/releases/download/4.12.0/composer-require-checker.phar.asc"}},"composerLock":null},"phpmd":{"api-version":"1.0.0","version":"1.0.2.0","type":"php-file","url":"https://phpcq.github.io/repository/plugin/phpmd/phpmd-1.0.2.0.php","signature":null,"requirements":{"php":{"php":"^7.3 || ^8.0","ext-dom":"*"},"tool":{"phpmd":"^2.6.1"}},"checksum":{"type":"sha-512","value":"f22280a6dec8dbdd2ec1d83b294f23237fe32c34f4a298e52038e0a7a0074d541635b2b488b1a6098a42d8418a6cd8eb804406ea82b91e362be2b5d11a0915b0"},"tools":{"phpmd":{"version":"2.15.0","url":"https://github.com/phpmd/phpmd/releases/download/2.15.0/phpmd.phar","requirements":{"php":{"php":">=5.3.9","ext-xml":"*"}},"checksum":null,"signature":"https://github.com/phpmd/phpmd/releases/download/2.15.0/phpmd.phar.asc"}},"composerLock":null},"phpcpd":{"api-version":"1.0.0","version":"1.1.1.0","type":"php-file","url":"https://phpcq.github.io/repository/plugin/phpcpd/phpcpd-1.1.1.0.php","signature":null,"requirements":{"php":{"php":"^7.3 || ^8.0","ext-dom":"*"},"tool":{"phpcpd":"^6.0"}},"checksum":{"type":"sha-512","value":"1189ce0bf3fade4cb4241f1d96f915ef8fc7651f4450dc79fdf464ee3d6be3009316f0d423ce2d4af9d76ad50807b7fdf4d77bfa6d9ee2c91d6eda32ea214433"},"tools":{"phpcpd":{"version":"6.0.3","url":"https://phar.phpunit.de/phpcpd-6.0.3.phar","requirements":{"php":{"php":">=7.3","ext-dom":"*"}},"checksum":{"type":"sha-256","value":"2cbaea7cfda1bb4299d863eb075e977c3f49055dd16d88529fae5150d48a84cb"},"signature":"https://phar.phpunit.de/phpcpd-6.0.3.phar.asc"}},"composerLock":null},"phploc":{"api-version":"1.0.0","version":"1.0.0.0","type":"php-file","url":"https://phpcq.github.io/repository/plugin/phploc/phploc-1.0.0.0.php","signature":null,"requirements":{"php":{"php":"^7.3 || ^8.0","ext-dom":"*","ext-json":"*"},"tool":{"phploc":"^3.0 || ^4.0 || ^5.0 || ^6.0 || ^7.0"}},"checksum":{"type":"sha-512","value":"f67b02d494796adf553cb3dd13ec06c1cb8e53c799954061749424251379541637538199afb3afa3c7a01cabd1cb6f1c53eb621f015dff9644c6c7cbf10c56d1"},"tools":{"phploc":{"version":"7.0.2","url":"https://phar.phpunit.de/phploc-7.0.2.phar","requirements":{"php":{"php":">=7.3","ext-dom":"*","ext-json":"*"}},"checksum":{"type":"sha-256","value":"3d59778ec86faf25fd00e3a329b2f9ad4a3c751ca91601ea7dab70f887b0bf46"},"signature":"https://phar.phpunit.de/phploc-7.0.2.phar.asc"}},"composerLock":null},"phpcs":{"api-version":"1.0.0","version":"1.2.0.0","type":"php-file","url":"https://phpcq.github.io/repository/plugin/phpcs/phpcs-1.2.0.0.php","signature":null,"requirements":{"php":{"php":"^7.3 || ^8.0","ext-dom":"*"},"tool":{"phpcs":"^3.0 || ^2.0","phpcbf":"^3.0 || ^2.0"}},"checksum":{"type":"sha-512","value":"b6ed00306e76068a6af5e3b1dec837724f9e1900ef1049ce88e7ce195b0583524ca33a73613fba13244307a7ca853b6ddaa14ded69f651c3f184ac130bd1aaad"},"tools":{"phpcs":{"version":"3.10.2","url":"https://github.com/PHPCSStandards/PHP_CodeSniffer/releases/download/3.10.2/phpcs.phar","requirements":{"php":{"php":">=5.4.0","ext-simplexml":"*","ext-tokenizer":"*","ext-xmlwriter":"*"}},"checksum":null,"signature":"https://github.com/PHPCSStandards/PHP_CodeSniffer/releases/download/3.10.2/phpcs.phar.asc"},"phpcbf":{"version":"3.10.2","url":"https://github.com/PHPCSStandards/PHP_CodeSniffer/releases/download/3.10.2/phpcbf.phar","requirements":{"php":{"php":">=5.4.0","ext-simplexml":"*","ext-tokenizer":"*","ext-xmlwriter":"*"}},"checksum":null,"signature":"https://github.com/PHPCSStandards/PHP_CodeSniffer/releases/download/3.10.2/phpcbf.phar.asc"}},"composerLock":null},"composer-normalize":{"api-version":"1.0.0","version":"1.1.1.0","type":"php-file","url":"https://phpcq.github.io/repository/plugin/composer-normalize/composer-normalize-1.1.1.0.php","signature":null,"requirements":{"php":{"php":"^7.3 || ^8.0","ext-json":"*"},"tool":{"composer-normalize":"^2.1"}},"checksum":{"type":"sha-512","value":"d9abda440b85d501c58abf9c81bf76f417594b397129215ffa8b777e9bb5e5eda37d7661d661db3c8d11c24f20345bc6fbe56f013b3b9435d459d2b94f086e0f"},"tools":{"composer-normalize":{"version":"2.43.0","url":"https://github.com/ergebnis/composer-normalize/releases/download/2.43.0/composer-normalize.phar","requirements":{"php":{"php":"~7.4.0 || ~8.0.0 || ~8.1.0 || ~8.2.0 || ~8.3.0","ext-json":"*"}},"checksum":null,"signature":"https://github.com/ergebnis/composer-normalize/releases/download/2.43.0/composer-normalize.phar.asc"}},"composerLock":null}},"tools":[]} \ No newline at end of file +{"plugins":{"phpunit":{"api-version":"1.0.0","version":"1.0.0.0","type":"php-file","url":"https://phpcq.github.io/repository/plugin/phpunit/phpunit-1.0.0.0.php","signature":null,"requirements":{"php":{"php":"^7.3 || ^8.0"},"tool":{"phpunit":"^6.0 || ^7.0 || ^8.0 || ^9.0"}},"checksum":{"type":"sha-512","value":"c73f15658e3ba62665f09492ec91c3a6a715760bfaa88473a987538439fff442540148e086e46a6aa18ce55a3ea2fbf76caaa581384cb84a38859fcc609ae7e4"},"tools":{"phpunit":{"version":"9.6.21","url":"https://phar.phpunit.de/phpunit-9.6.21.phar","requirements":{"php":{"php":">=7.3","ext-dom":"*","ext-json":"*","ext-libxml":"*","ext-mbstring":"*","ext-xml":"*","ext-xmlwriter":"*"}},"checksum":{"type":"sha-256","value":"32bd24e7f93be631898ae61a5038f23da9ebd0e40a1124e65d9ee633b33f1815"},"signature":"https://phar.phpunit.de/phpunit-9.6.21.phar.asc"}},"composerLock":null},"psalm":{"api-version":"1.0.0","version":"1.2.0.0","type":"php-file","url":"https://phpcq.github.io/repository/plugin/psalm/psalm-1.2.0.0.php","signature":null,"requirements":{"php":{"php":"^7.4 || ^8.0","ext-dom":"*"},"tool":{"psalm":"^3.0 || ^4.0 || ^5.0"}},"checksum":{"type":"sha-512","value":"4a550c9226d7bca582d7c10bd87cce01190c96398936b1613421640c83df62ed1c6e0d44c1b39635414ea8cf4a892a6458d27590793238add24e7cb5547e6ffd"},"tools":{"psalm":{"version":"5.26.1","url":"https://github.com/vimeo/psalm/releases/download/5.26.1/psalm.phar","requirements":{"php":{"php":"^7.4 || ~8.0.0 || ~8.1.0 || ~8.2.0 || ~8.3.0","ext-SimpleXML":"*","ext-ctype":"*","ext-dom":"*","ext-json":"*","ext-libxml":"*","ext-mbstring":"*","ext-tokenizer":"*"}},"checksum":null,"signature":"https://github.com/vimeo/psalm/releases/download/5.26.1/psalm.phar.asc"}},"composerLock":null},"composer-require-checker":{"api-version":"1.0.0","version":"1.1.1.0","type":"php-file","url":"https://phpcq.github.io/repository/plugin/composer-require-checker/composer-require-checker-1.1.1.0.php","signature":null,"requirements":{"php":{"php":"^7.4 || ^8.0"},"tool":{"composer-require-checker":"^3.8 || ^4.0"}},"checksum":{"type":"sha-512","value":"d5415bddfe024c5749d894034583882aee4e5c3e1087815d9fdd81cb5e71630f631a0e35de0ff84b97fbbf738c16ece5f83bd8c00695913eb846aa6f04577dc2"},"tools":{"composer-require-checker":{"version":"4.13.0","url":"https://github.com/maglnet/ComposerRequireChecker/releases/download/4.13.0/composer-require-checker.phar","requirements":{"php":{"php":"~8.2.0 || ~8.3.0 || ~8.4.0","ext-phar":"*"}},"checksum":null,"signature":"https://github.com/maglnet/ComposerRequireChecker/releases/download/4.13.0/composer-require-checker.phar.asc"}},"composerLock":null},"phpmd":{"api-version":"1.0.0","version":"1.0.2.0","type":"php-file","url":"https://phpcq.github.io/repository/plugin/phpmd/phpmd-1.0.2.0.php","signature":null,"requirements":{"php":{"php":"^7.3 || ^8.0","ext-dom":"*"},"tool":{"phpmd":"^2.6.1"}},"checksum":{"type":"sha-512","value":"f22280a6dec8dbdd2ec1d83b294f23237fe32c34f4a298e52038e0a7a0074d541635b2b488b1a6098a42d8418a6cd8eb804406ea82b91e362be2b5d11a0915b0"},"tools":{"phpmd":{"version":"2.15.0","url":"https://github.com/phpmd/phpmd/releases/download/2.15.0/phpmd.phar","requirements":{"php":{"php":">=5.3.9","ext-xml":"*"}},"checksum":null,"signature":"https://github.com/phpmd/phpmd/releases/download/2.15.0/phpmd.phar.asc"}},"composerLock":null},"phpcpd":{"api-version":"1.0.0","version":"1.1.1.0","type":"php-file","url":"https://phpcq.github.io/repository/plugin/phpcpd/phpcpd-1.1.1.0.php","signature":null,"requirements":{"php":{"php":"^7.3 || ^8.0","ext-dom":"*"},"tool":{"phpcpd":"^6.0"}},"checksum":{"type":"sha-512","value":"1189ce0bf3fade4cb4241f1d96f915ef8fc7651f4450dc79fdf464ee3d6be3009316f0d423ce2d4af9d76ad50807b7fdf4d77bfa6d9ee2c91d6eda32ea214433"},"tools":{"phpcpd":{"version":"6.0.3","url":"https://phar.phpunit.de/phpcpd-6.0.3.phar","requirements":{"php":{"php":">=7.3","ext-dom":"*"}},"checksum":{"type":"sha-256","value":"2cbaea7cfda1bb4299d863eb075e977c3f49055dd16d88529fae5150d48a84cb"},"signature":"https://phar.phpunit.de/phpcpd-6.0.3.phar.asc"}},"composerLock":null},"phploc":{"api-version":"1.0.0","version":"1.0.0.0","type":"php-file","url":"https://phpcq.github.io/repository/plugin/phploc/phploc-1.0.0.0.php","signature":null,"requirements":{"php":{"php":"^7.3 || ^8.0","ext-dom":"*","ext-json":"*"},"tool":{"phploc":"^3.0 || ^4.0 || ^5.0 || ^6.0 || ^7.0"}},"checksum":{"type":"sha-512","value":"f67b02d494796adf553cb3dd13ec06c1cb8e53c799954061749424251379541637538199afb3afa3c7a01cabd1cb6f1c53eb621f015dff9644c6c7cbf10c56d1"},"tools":{"phploc":{"version":"7.0.2","url":"https://phar.phpunit.de/phploc-7.0.2.phar","requirements":{"php":{"php":">=7.3","ext-dom":"*","ext-json":"*"}},"checksum":{"type":"sha-256","value":"3d59778ec86faf25fd00e3a329b2f9ad4a3c751ca91601ea7dab70f887b0bf46"},"signature":"https://phar.phpunit.de/phploc-7.0.2.phar.asc"}},"composerLock":null},"phpcs":{"api-version":"1.0.0","version":"1.2.0.0","type":"php-file","url":"https://phpcq.github.io/repository/plugin/phpcs/phpcs-1.2.0.0.php","signature":null,"requirements":{"php":{"php":"^7.3 || ^8.0","ext-dom":"*"},"tool":{"phpcs":"^3.0 || ^2.0","phpcbf":"^3.0 || ^2.0"}},"checksum":{"type":"sha-512","value":"b6ed00306e76068a6af5e3b1dec837724f9e1900ef1049ce88e7ce195b0583524ca33a73613fba13244307a7ca853b6ddaa14ded69f651c3f184ac130bd1aaad"},"tools":{"phpcs":{"version":"3.10.3","url":"https://github.com/PHPCSStandards/PHP_CodeSniffer/releases/download/3.10.3/phpcs.phar","requirements":{"php":{"php":">=5.4.0","ext-simplexml":"*","ext-tokenizer":"*","ext-xmlwriter":"*"}},"checksum":null,"signature":"https://github.com/PHPCSStandards/PHP_CodeSniffer/releases/download/3.10.3/phpcs.phar.asc"},"phpcbf":{"version":"3.10.3","url":"https://github.com/PHPCSStandards/PHP_CodeSniffer/releases/download/3.10.3/phpcbf.phar","requirements":{"php":{"php":">=5.4.0","ext-simplexml":"*","ext-tokenizer":"*","ext-xmlwriter":"*"}},"checksum":null,"signature":"https://github.com/PHPCSStandards/PHP_CodeSniffer/releases/download/3.10.3/phpcbf.phar.asc"}},"composerLock":null},"composer-normalize":{"api-version":"1.0.0","version":"1.1.1.0","type":"php-file","url":"https://phpcq.github.io/repository/plugin/composer-normalize/composer-normalize-1.1.1.0.php","signature":null,"requirements":{"php":{"php":"^7.3 || ^8.0","ext-json":"*"},"tool":{"composer-normalize":"^2.1"}},"checksum":{"type":"sha-512","value":"d9abda440b85d501c58abf9c81bf76f417594b397129215ffa8b777e9bb5e5eda37d7661d661db3c8d11c24f20345bc6fbe56f013b3b9435d459d2b94f086e0f"},"tools":{"composer-normalize":{"version":"2.44.0","url":"https://github.com/ergebnis/composer-normalize/releases/download/2.44.0/composer-normalize.phar","requirements":{"php":{"php":"~7.4.0 || ~8.0.0 || ~8.1.0 || ~8.2.0 || ~8.3.0 || ~8.4.0","ext-json":"*"}},"checksum":null,"signature":"https://github.com/ergebnis/composer-normalize/releases/download/2.44.0/composer-normalize.phar.asc"}},"composerLock":null}},"tools":[]} \ No newline at end of file diff --git a/composer.json b/composer.json index d7cad1845..6db2b20b9 100644 --- a/composer.json +++ b/composer.json @@ -40,12 +40,15 @@ "discordier/justtextwidgets": "^1.3", "doctrine/cache": "^2.1", "doctrine/dbal": "^3.6.0", + "doctrine/doctrine-bundle": "^2.4", "doctrine/orm": "^2.16.0", + "knplabs/knp-menu": "^3.1", "menatwork/contao-multicolumnwizard-bundle": "^3.6.7", "psr/container": "^1.1.2", "psr/log": "^2.0.0", "symfony/asset": "^5.4", "symfony/cache": "^5.4", + "symfony/cache-contracts": "^2.5", "symfony/config": "^5.4", "symfony/console": "^5.4", "symfony/dependency-injection": "^5.4", @@ -54,6 +57,7 @@ "symfony/event-dispatcher-contracts": "^2.5.2", "symfony/filesystem": "^5.4", "symfony/finder": "^5.4", + "symfony/framework-bundle": "^5.4", "symfony/http-foundation": "^5.4", "symfony/http-kernel": "^5.4", "symfony/routing": "^5.4", @@ -68,6 +72,7 @@ "contao/manager-bundle": "^4.13.0 <5.0", "contao/manager-plugin": "^2.8", "doctrine/doctrine-bundle": "^1.8.1 || ^2.8.3", + "inspiredminds/contao-file-usage": "^3.0", "phpcq/runner-bootstrap": "^1.0@dev" }, "autoload": { diff --git a/src/CoreBundle/EventListener/SubSystemBootListener.php b/src/CoreBundle/EventListener/SubSystemBootListener.php index e7f18a108..efec25f57 100644 --- a/src/CoreBundle/EventListener/SubSystemBootListener.php +++ b/src/CoreBundle/EventListener/SubSystemBootListener.php @@ -174,8 +174,10 @@ public function boot(): void * @param MetaModelsBootEvent $event The event payload. * * @return void + * + * @psalm-suppress DeprecatedClass */ - private function tryDispatch($eventName, MetaModelsBootEvent $event): void + private function tryDispatch(string $eventName, MetaModelsBootEvent $event): void { if ($this->dispatcher->hasListeners($eventName)) { // @codingStandardsIgnoreStart diff --git a/src/CoreBundle/FileUsage/MetaModelsMultipleResult.php b/src/CoreBundle/FileUsage/MetaModelsMultipleResult.php new file mode 100644 index 000000000..bf74a1b58 --- /dev/null +++ b/src/CoreBundle/FileUsage/MetaModelsMultipleResult.php @@ -0,0 +1,43 @@ +tableName; + } + + public function getAttributeName(): string + { + return $this->attributeName; + } + + public function getItemId(): string + { + return $this->itemId; + } + + public function getEditUrl(): string + { + return $this->editUrl; + } + + public function getTemplate(): string + { + return '@MetaModelsCore/FileUsage/file_usage_multiple_result.html.twig'; + } +} diff --git a/src/CoreBundle/FileUsage/MetaModelsSingleResult.php b/src/CoreBundle/FileUsage/MetaModelsSingleResult.php new file mode 100644 index 000000000..8ac7cdb5c --- /dev/null +++ b/src/CoreBundle/FileUsage/MetaModelsSingleResult.php @@ -0,0 +1,43 @@ +tableName; + } + + public function getAttributeName(): string + { + return $this->attributeName; + } + + public function getItemId(): string + { + return $this->itemId; + } + + public function getEditUrl(): string + { + return $this->editUrl; + } + + public function getTemplate(): string + { + return '@MetaModelsCore/FileUsage/file_usage_single_result.html.twig'; + } +} diff --git a/src/CoreBundle/FileUsage/MetaModelsTranslatedMultipleResult.php b/src/CoreBundle/FileUsage/MetaModelsTranslatedMultipleResult.php new file mode 100644 index 000000000..4c876696d --- /dev/null +++ b/src/CoreBundle/FileUsage/MetaModelsTranslatedMultipleResult.php @@ -0,0 +1,49 @@ +tableName; + } + + public function getAttributeName(): string + { + return $this->attributeName; + } + + public function getItemId(): string + { + return $this->itemId; + } + + public function getLanguage(): string + { + return $this->language; + } + + public function getEditUrl(): string + { + return $this->editUrl; + } + + public function getTemplate(): string + { + return '@MetaModelsCore/FileUsage/file_usage_translated_multiple_result.html.twig'; + } +} diff --git a/src/CoreBundle/FileUsage/MetaModelsTranslatedSingleResult.php b/src/CoreBundle/FileUsage/MetaModelsTranslatedSingleResult.php new file mode 100644 index 000000000..61118e367 --- /dev/null +++ b/src/CoreBundle/FileUsage/MetaModelsTranslatedSingleResult.php @@ -0,0 +1,49 @@ +tableName; + } + + public function getAttributeName(): string + { + return $this->attributeName; + } + + public function getItemId(): string + { + return $this->itemId; + } + + public function getLanguage(): string + { + return $this->language; + } + + public function getEditUrl(): string + { + return $this->editUrl; + } + + public function getTemplate(): string + { + return '@MetaModelsCore/FileUsage/file_usage_translated_single_result.html.twig'; + } +} diff --git a/src/CoreBundle/Resources/translations/metamodels_file_usage.en.xlf b/src/CoreBundle/Resources/translations/metamodels_file_usage.en.xlf new file mode 100644 index 000000000..4096154b0 --- /dev/null +++ b/src/CoreBundle/Resources/translations/metamodels_file_usage.en.xlf @@ -0,0 +1,19 @@ + + + + + + "%metaModelName%" in attribute "%attribute%" + + + "%metaModelName%" in attribute "%attribute%" in language "%language%" + + + Edit "%metaModelName%" dataset with id %id% + + + Edit "%metaModelName%" dataset with id %id% in language %language% + + + + diff --git a/src/CoreBundle/Resources/views/FileUsage/file_usage_multiple_result.html.twig b/src/CoreBundle/Resources/views/FileUsage/file_usage_multiple_result.html.twig new file mode 100644 index 000000000..b6157b8ae --- /dev/null +++ b/src/CoreBundle/Resources/views/FileUsage/file_usage_multiple_result.html.twig @@ -0,0 +1,24 @@ +{% trans_default_domain 'metamodels_file_usage' %} +{% set metaModelName = 'name'|trans(domain: result.tableName) %} +{% set attributeName = (result.attributeName ~ '.label')|trans(domain: result.tableName) %} + + + MetaModels + + + - + + + {{ 'single_usage'|trans({'%metaModelName%': metaModelName, '%attribute%': attributeName}) }} + + + ID {{ result.itemId }} + + + {% if result.editUrl|default %} + + + + {% endif %} + + diff --git a/src/CoreBundle/Resources/views/FileUsage/file_usage_single_result.html.twig b/src/CoreBundle/Resources/views/FileUsage/file_usage_single_result.html.twig new file mode 100644 index 000000000..018ade898 --- /dev/null +++ b/src/CoreBundle/Resources/views/FileUsage/file_usage_single_result.html.twig @@ -0,0 +1,25 @@ +{% trans_default_domain 'metamodels_file_usage' %} +{% set metaModelName = 'name'|trans(domain: result.tableName) %} +{% set attributeName = (result.attributeName ~ '.label')|trans(domain: result.tableName) %} +{% set translationParameters = {'%metaModelName%': metaModelName, '%attribute%': attributeName, '%id%': result.itemId} %} + + + MetaModels + + + - + + + {{ 'single_usage'|trans(translationParameters) }} + + + ID {{ result.itemId }} + + + {% if result.editUrl|default %} + + + + {% endif %} + + diff --git a/src/CoreBundle/Resources/views/FileUsage/file_usage_translated_multiple_result.html.twig b/src/CoreBundle/Resources/views/FileUsage/file_usage_translated_multiple_result.html.twig new file mode 100644 index 000000000..f2af762eb --- /dev/null +++ b/src/CoreBundle/Resources/views/FileUsage/file_usage_translated_multiple_result.html.twig @@ -0,0 +1,26 @@ +{% trans_default_domain 'metamodels_file_usage' %} +{% set metaModelName = 'name'|trans(domain: result.tableName) %} +{% set attributeName = (result.attributeName ~ '.label')|trans(domain: result.tableName) %} +{% set language = ('LNG.' ~ result.language)|trans(domain: 'contao_languages') %} +{% set translationParameters = {'%metaModelName%': metaModelName, '%attribute%': attributeName, '%id%': result.itemId, '%language%': language} %} + + + MetaModels + + + - + + + {{ 'single_usage_translated'|trans(translationParameters) }} + + + ID {{ result.itemId }} + + + {% if result.editUrl|default %} + + + + {% endif %} + + diff --git a/src/CoreBundle/Resources/views/FileUsage/file_usage_translated_single_result.html.twig b/src/CoreBundle/Resources/views/FileUsage/file_usage_translated_single_result.html.twig new file mode 100644 index 000000000..f2af762eb --- /dev/null +++ b/src/CoreBundle/Resources/views/FileUsage/file_usage_translated_single_result.html.twig @@ -0,0 +1,26 @@ +{% trans_default_domain 'metamodels_file_usage' %} +{% set metaModelName = 'name'|trans(domain: result.tableName) %} +{% set attributeName = (result.attributeName ~ '.label')|trans(domain: result.tableName) %} +{% set language = ('LNG.' ~ result.language)|trans(domain: 'contao_languages') %} +{% set translationParameters = {'%metaModelName%': metaModelName, '%attribute%': attributeName, '%id%': result.itemId, '%language%': language} %} + + + MetaModels + + + - + + + {{ 'single_usage_translated'|trans(translationParameters) }} + + + ID {{ result.itemId }} + + + {% if result.editUrl|default %} + + + + {% endif %} + + diff --git a/src/CoreBundle/Translator/MetaModelTranslationLoader.php b/src/CoreBundle/Translator/MetaModelTranslationLoader.php index 66dcb4343..46cd07c12 100644 --- a/src/CoreBundle/Translator/MetaModelTranslationLoader.php +++ b/src/CoreBundle/Translator/MetaModelTranslationLoader.php @@ -72,19 +72,19 @@ public function __construct( public function load($resource, string $locale, string $domain = 'messages'): MessageCatalogue { // Load tl_metamodel_item catalogue. - $base = $this->baseTranslator->getCatalogue($locale); + $metaModel = $this->factory->getMetaModel($domain); + if (null === $metaModel) { + throw new NotFoundResourceException('Failed to load MetaModel: ' . $domain); + } $catalog = new MessageCatalogue($locale); + $catalog->set('name', $metaModel->getName(), $domain); + $base = $this->baseTranslator->getCatalogue($locale); foreach ($base->all('tl_metamodel_item') as $key => $value) { $catalog->set($key, $value, $domain); } - $metaModel = $this->factory->getMetaModel($domain); - if (null === $metaModel) { - throw new NotFoundResourceException('Failed to load MetaModel: ' . $domain); - } - /** * @psalm-suppress DeprecatedMethod * @psalm-suppress TooManyArguments diff --git a/src/Render/Template.php b/src/Render/Template.php index 5817125e2..1a228aeea 100644 --- a/src/Render/Template.php +++ b/src/Render/Template.php @@ -25,7 +25,6 @@ namespace MetaModels\Render; -use Contao\Config; use Contao\BackendTemplate; use Contao\CoreBundle\Framework\Adapter; use Contao\FrontendTemplate; @@ -35,8 +34,7 @@ use Exception; use MetaModels\Helper\ContaoController; use RuntimeException; - -use function array_key_exists; +use Symfony\Component\DependencyInjection\ContainerInterface; /** * Template class for MetaModels. @@ -458,7 +456,11 @@ public function parse($strOutputFormat, $blnFailIfNotFound = false) // Add start and end markers in debug mode. $container = System::getContainer(); - if ($container && $container->getParameter('kernel.debug') && ('html5' === $this->strFormat)) { + if ( + ($container instanceof ContainerInterface) + && true === $container->getParameter('kernel.debug') + && ('html5' === $this->strFormat) + ) { $rootDir = $container->getParameter('kernel.project_dir'); assert(\is_string($rootDir)); $strRelPath =