Skip to content

Commit

Permalink
Twig template fix
Browse files Browse the repository at this point in the history
  • Loading branch information
markocupic committed Dec 23, 2023
1 parent 844f303 commit 9faf9f8
Show file tree
Hide file tree
Showing 139 changed files with 1,454 additions and 1,310 deletions.
10 changes: 10 additions & 0 deletions .ecs/batch/check/default.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
:: Run easy-coding-standard (ecs) via this batch file inside your IDE e.g. PhpStorm (Windows only)
:: Install inside PhpStorm the "Batch Script Support" plugin
cd..
cd..
cd..
cd..
cd..
cd..
vendor\bin\ecs check vendor/markocupic/gallery-creator-bundle/src --config vendor/markocupic/gallery-creator-bundle/.ecs/config/default.php
cd vendor/markocupic/gallery-creator-bundle/.ecs./batch/check
10 changes: 10 additions & 0 deletions .ecs/batch/check/tests.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
:: Run easy-coding-standard (ecs) via this batch file inside your IDE e.g. PhpStorm (Windows only)
:: Install inside PhpStorm the "Batch Script Support" plugin
cd..
cd..
cd..
cd..
cd..
cd..
vendor\bin\ecs check vendor/markocupic/gallery-creator-bundle/tests --config vendor/markocupic/gallery-creator-bundle/.ecs/config/default.php
cd vendor/markocupic/gallery-creator-bundle/.ecs./batch/check
11 changes: 11 additions & 0 deletions .ecs/batch/fix/default.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
:: Run easy-coding-standard (ecs) via this batch file inside your IDE e.g. PhpStorm (Windows only)
:: Install inside PhpStorm the "Batch Script Support" plugin
cd..
cd..
cd..
cd..
cd..
cd..
vendor\bin\ecs check vendor/markocupic/gallery-creator-bundle/src --fix --config vendor/markocupic/gallery-creator-bundle/.ecs/config/default.php

cd vendor/markocupic/gallery-creator-bundle/.ecs./batch/fix
10 changes: 10 additions & 0 deletions .ecs/batch/fix/tests.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
:: Run easy-coding-standard (ecs) via this batch file inside your IDE e.g. PhpStorm (Windows only)
:: Install inside PhpStorm the "Batch Script Support" plugin
cd..
cd..
cd..
cd..
cd..
cd..
vendor\bin\ecs check vendor/markocupic/gallery-creator-bundle/tests --fix --config vendor/markocupic/gallery-creator-bundle/.ecs/config/default.php
cd vendor/markocupic/gallery-creator-bundle/.ecs./batch/fix
16 changes: 16 additions & 0 deletions .ecs/config/default.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

declare(strict_types=1);

use Symplify\EasyCodingStandard\Config\ECSConfig;

return static function (ECSConfig $ECSConfig): void {
// Contao
$ECSConfig->import(__DIR__ . '../../../../../contao/easy-coding-standard/config/contao.php');

// Custom
$ECSConfig->import(__DIR__.'/set/header_comment_fixer.php');

// Custom
$ECSConfig->import(__DIR__.'/set/skip_configuration.php');
};
18 changes: 18 additions & 0 deletions .ecs/config/set/header_comment_fixer.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

declare(strict_types=1);

use PhpCsFixer\Fixer\Comment\HeaderCommentFixer;
use Symplify\EasyCodingStandard\Config\ECSConfig;

return static function (ECSConfig $ECSConfig): void {

$services = $ECSConfig->services();

$services
->set(HeaderCommentFixer::class)
->call('configure', [[
'header' => "This file is part of Gallery Creator Bundle.\n\n(c) Marko Cupic ".date('Y')." <[email protected]>\n@license GPL-3.0-or-later\nFor the full copyright and license information,\nplease view the LICENSE file that was distributed with this source code.\n@link https://github.com/markocupic/gallery-creator-bundle",
]])
;
};
19 changes: 19 additions & 0 deletions .ecs/config/set/skip_configuration.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

declare(strict_types=1);

use Symplify\EasyCodingStandard\Config\ECSConfig;
use PhpCsFixer\Fixer\Whitespace\MethodChainingIndentationFixer;
use Symplify\EasyCodingStandard\ValueObject\Option;

return function (ECSConfig $ECSConfig): void {
$parameters = $ECSConfig->parameters();

$parameters->set(Option::SKIP, [

MethodChainingIndentationFixer::class => [
'*/DependencyInjection/Configuration.php',

],
]);
};
6 changes: 3 additions & 3 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@ end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

[*.{php,twig,yaml}]
[*.{php,twig,yml}]
indent_style = space
indent_size = 4

[*.{html5,svg,min.css,min.js}]
insert_final_newline = false

[*/public/**.{css,js,php}]
[*/src/Resources/contao/**.{css,js,php}]
indent_style = tab

[*/contao/**.html5]
[*/src/Resources/contao/**.html5]
indent_style = space
indent_size = 2
4 changes: 1 addition & 3 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# Auto detect text files and perform LF normalization
* text eol=lf

#* text=auto
* text=auto

# Custom for Visual Studio
*.cs diff=csharp
Expand Down
24 changes: 14 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
![Marko Cupic](docs/logo.png?raw=true "Marko Cupic")
<p><a href="https://github.com/markocupic"><img src="src/Resources/public/images/be_content_element_logo.svg"></a></p>

# Gallery Creator Bundle

Expand Down Expand Up @@ -83,19 +83,21 @@ declare(strict_types=1);

namespace App\EventListener;

use Contao\CoreBundle\Controller\ContentElement\AbstractContentElementController;
use Contao\CoreBundle\DependencyInjection\Attribute\AsHook;
use Contao\CoreBundle\Twig\FragmentTemplate;
use Contao\CoreBundle\ServiceAnnotation\Hook;
use Contao\Template;
use Markocupic\GalleryCreatorBundle\Controller\ContentElement\AbstractContentElementController;
use Markocupic\GalleryCreatorBundle\Model\GalleryCreatorAlbumsModel;

#[AsHook(GalleryCreatorFrontendTemplateListener::HOOK, priority: 100)]
/**
* @Hook(GalleryCreatorFrontendTemplateListener::HOOK, priority=100)
*/
class GalleryCreatorFrontendTemplateListener
{
public const HOOK = 'galleryCreatorGenerateFrontendTemplate';

public function __invoke(AbstractContentElementController $contentElement, Fragmenttemplate $template, GalleryCreatorAlbumsModel|null $activeAlbum = null)
public function __invoke(AbstractContentElementController $contentElement, Template $template, ?GalleryCreatorAlbumsModel $activeAlbum = null)
{
$template->set('foo', 'bar');
$template->foo = 'bar';
}
}

Expand All @@ -118,11 +120,13 @@ declare(strict_types=1);
namespace App\EventListener;

use Contao\BackendUser;
use Contao\CoreBundle\DependencyInjection\Attribute\AsHook;
use Contao\CoreBundle\ServiceAnnotation\Hook;
use Markocupic\GalleryCreatorBundle\Model\GalleryCreatorPicturesModel;
use Symfony\Bundle\SecurityBundle\Security;
use Symfony\Component\Security\Core\Security;

#[AsHook(GalleryCreatorImagePostInsertListener::HOOK, priority: 100)]
/**
* @Hook(GalleryCreatorImagePostInsertListener::HOOK, priority=100)
*/
class GalleryCreatorImagePostInsertListener
{
public const HOOK = 'galleryCreatorImagePostInsert';
Expand Down
90 changes: 39 additions & 51 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,54 +1,42 @@
{
"name": "markocupic/gallery-creator-bundle",
"keywords": [
"Contao",
"gallery",
"album",
"plugin"
],
"type": "contao-bundle",
"description": "gallery extension for Contao CMS",
"license": "LGPL-3.0+",
"authors": [
{
"name": "Marko Cupic",
"email": "[email protected]",
"homepage": "https://github.com/markocupic",
"role": "Developer"
}
],
"support": {
"issues": "https://github.com/markocupic/gallery-creator-bundle/issues",
"source": "https://github.com/markocupic/gallery-creator-bundle",
"forum": "https://community.contao.org/de/showthread.php?22634-gallery_creator"
},
"require": {
"contao/core-bundle": "^5.0",
"php": "^8.1",
"jaybizzle/crawler-detect": "^1.2",
"league/commonmark": "^2.3"
},
"require-dev": {
"contao/easy-coding-standard": "^5.0"
},
"autoload": {
"psr-4": {
"Markocupic\\GalleryCreatorBundle\\": "src/"
}
},
"extra": {
"contao-manager-plugin": "Markocupic\\GalleryCreatorBundle\\ContaoManager\\Plugin"
},
"config": {
"allow-plugins": {
"contao/manager-plugin": false,
"contao-components/installer": false,
"dealerdirect/phpcodesniffer-composer-installer": true
}
},
"scripts": {
"cs-fixer": "@php tools/ecs/vendor/bin/ecs check config/ contao/ src/ tests/ --config tools/ecs/config.php --fix --ansi",
"unit-tests": "@php tools/phpunit/vendor/bin/phpunit -c tools/phpunit/phpunit.xml.dist",
"phpstan": "@php tools/phpstan/vendor/bin/phpstan analyse src tests"
"name": "markocupic/gallery-creator-bundle",
"keywords": [
"Contao",
"gallery",
"album",
"plugin"
],
"type": "contao-bundle",
"description": "gallery extension for Contao CMS",
"license": "LGPL-3.0+",
"authors": [
{
"name": "Marko Cupic",
"email": "[email protected]",
"homepage": "https://github.com/markocupic",
"role": "Developer"
}
],
"support": {
"issues": "https://github.com/markocupic/gallery-creator-bundle/issues",
"source": "https://github.com/markocupic/gallery-creator-bundle",
"forum": "https://community.contao.org/de/showthread.php?22634-gallery_creator"
},
"require": {
"contao/core-bundle": "^4.13 || ^5.0 || > 5.0.0-RC3",
"php": "^7.4 || ^8.0",
"jaybizzle/crawler-detect": "^1.2",
"league/commonmark": "^2.2"
},
"require-dev": {
"contao/easy-coding-standard": "^5.0"
},
"autoload": {
"psr-4": {
"Markocupic\\GalleryCreatorBundle\\": "src/"
}
},
"extra": {
"contao-manager-plugin": "Markocupic\\GalleryCreatorBundle\\ContaoManager\\Plugin"
}
}
3 changes: 0 additions & 3 deletions config/routes.yaml

This file was deleted.

Empty file removed contao/templates/_new/.twig-root
Empty file.
84 changes: 0 additions & 84 deletions contao/templates/_new/component/_album.html.twig

This file was deleted.

Loading

0 comments on commit 9faf9f8

Please sign in to comment.