1
0

~ aus Bundle Creator

This commit is contained in:
Stephan Gieb 2025-03-19 13:47:06 +01:00
parent 4dfe2cda93
commit 75b4bbf2bb
30 changed files with 2801 additions and 0 deletions

25
.editorconfig Normal file
View File

@ -0,0 +1,25 @@
# EditorConfig is awesome: http://EditorConfig.org
# top-most EditorConfig file
root = true
# Unix-style newlines with a newline ending every file
[*]
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
[*.{php,twig,yml,yaml}]
indent_style = space
indent_size = 4
[*.{html5,svg,min.css,min.js}]
insert_final_newline = false
[*/contao/**.{css,js,php},*/public/**.{css,js}]
indent_style = tab
[*/contao/**.html5]
indent_style = space
indent_size = 2

7
.gitattributes vendored Normal file
View File

@ -0,0 +1,7 @@
/.ecs
/.github export-ignore
/tests export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
/phpunit.xml.dist export-ignore
/.travis.yml export-ignore

76
.github/workflows/ci.yml vendored Normal file
View File

@ -0,0 +1,76 @@
name: CI
on:
pull_request: ~
push:
branches:
- '*'
tags:
- '*'
jobs:
cs:
name: Coding Style
runs-on: ubuntu-latest
steps:
- name: Setup PHP
uses: shivammathur/setup-php@v2
- name: Checkout
uses: actions/checkout@v2
- name: Install ecs
run: cd tools/ecs && composer update --no-interaction --no-suggest
- name: Run the CS fixer
run: composer cs-fixer
tests:
name: PHP ${{ matrix.php }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php: [ 8.1, 8.2 ]
steps:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
- name: Checkout
uses: actions/checkout@v2
- name: Install phpunit
run: cd tools/phpunit && composer update --no-interaction --no-suggest
- name: Install the dependencies
run: composer update --no-interaction --no-suggest
- name: Run the unit tests
run: composer unit-tests
prefer-lowest-tests:
name: PHP ${{ matrix.php }} --prefer-lowest
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php: [ 8.1, 8.2 ]
steps:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
- name: Checkout
uses: actions/checkout@v2
- name: Install phpunit
run: cd tools/phpunit && composer update --no-interaction --no-suggest
- name: Install the dependencies
run: composer update --prefer-lowest --prefer-stable --no-interaction --no-suggest
- name: Run the unit tests
run: composer unit-tests

9
.gitignore vendored Normal file
View File

@ -0,0 +1,9 @@
# Jetbrains
/.idea/*
# tools
/vendor/
/tools/*/vendor
/composer.lock
/.php-cs-fixer.cache
/tools/phpunit/.phpunit.result.cache

41
composer.json Normal file
View File

@ -0,0 +1,41 @@
{
"name": "yupdesign/contao-architecture-projects-bundle",
"description": "Verwalten von Projekten für Architekten",
"type": "contao-bundle",
"license": "GPL-3.0-or-later",
"authors": [
{
"name": "Stephan Gieb",
"email": "stephan.gieb@yupdesign.de",
"homepage": "https://www.yupdesign.de",
"role": "Developer"
}
],
"require": {
"php": "^8.1",
"contao/core-bundle": "^4.13 || ^5.0"
},
"require-dev": {
"contao/manager-plugin": "^2.12"
},
"autoload": {
"psr-4": {
"Yupdesign\\ContaoArchitectureProjectsBundle\\": "src/"
}
},
"config": {
"allow-plugins": {
"contao-components/installer": false,
"contao/manager-plugin": false,
"contao-community-alliance/composer-plugin": true
}
},
"extra": {
"contao-manager-plugin": "Yupdesign\\ContaoArchitectureProjectsBundle\\ContaoManager\\Plugin"
},
"scripts": {
"cs-fixer": "@php tools/ecs/vendor/bin/ecs check config/ contao/ src/ templates/ tests/ --config tools/ecs/config.php --fix --ansi",
"unit-tests": "@php tools/phpunit/vendor/bin/phpunit -c tools/phpunit/phpunit.xml.dist"
},
"version": "0.0.1"
}

3
config/listener.yaml Normal file
View File

@ -0,0 +1,3 @@
#config/listener.yaml
services:

3
config/parameters.yaml Normal file
View File

@ -0,0 +1,3 @@
#config/parameters.yaml
parameters:

15
config/services.yaml Normal file
View File

@ -0,0 +1,15 @@
# config/services.yaml
services:
_defaults:
autowire: true # Automatically injects dependencies in your services.
autoconfigure: true # Automatically registers your services as commands, event subscribers, etc.
public: false # Allows optimizing the container by removing unused services; this also means
# fetching services directly from the container via $container->get() won't work.
# The best practice is to be explicit about your dependencies anyway.
bind:
#$projectDir: '%kernel.project_dir%'
Yupdesign\ContaoArchitectureProjectsBundle\:
resource: ../src/
exclude: ../src/{DependencyInjection,Model,Session}

25
contao/config/config.php Normal file
View File

@ -0,0 +1,25 @@
<?php
/*
* This file is part of ContaoArchitectureProjectsBundle.
*
* (c) Stephan Gieb 2025 <stephan.gieb@yupdesign.de>
* @license GPL-3.0-or-later
* For the full copyright and license information,
* please view the LICENSE file that was distributed with this source code.
* @link https://github.com/yupdesign/contao-architecture-projects-bundle
*/
use Yupdesign\ContaoArchitectureProjectsBundle\Model\ArchProjectsModel;
/**
* Backend modules
*/
$GLOBALS['BE_MOD']['architecture_projects']['arch_projects'] = array(
'tables' => array('tl_arch_projects')
);
/**
* Models
*/
$GLOBALS['TL_MODELS']['tl_arch_projects'] = ArchProjectsModel::class;

View File

@ -0,0 +1,149 @@
<?php
declare(strict_types=1);
/*
* This file is part of ContaoArchitectureProjectsBundle.
*
* (c) Stephan Gieb 2025 <stephan.gieb@yupdesign.de>
* @license GPL-3.0-or-later
* For the full copyright and license information,
* please view the LICENSE file that was distributed with this source code.
* @link https://github.com/yupdesign/contao-architecture-projects-bundle
*/
use Contao\Backend;
use Contao\DataContainer;
use Contao\DC_Table;
use Contao\Input;
/**
* Table tl_arch_projects
*/
$GLOBALS['TL_DCA']['tl_arch_projects'] = array(
'config' => array(
'dataContainer' => DC_Table::class,
'enableVersioning' => true,
'sql' => array(
'keys' => array(
'id' => 'primary'
)
),
),
'list' => array(
'sorting' => array(
'mode' => DataContainer::MODE_SORTABLE,
'fields' => array('title'),
'flag' => DataContainer::SORT_INITIAL_LETTER_ASC,
'panelLayout' => 'filter;sort,search,limit'
),
'label' => array(
'fields' => array('title'),
'format' => '%s',
),
'global_operations' => array(
'all' => array(
'href' => 'act=select',
'class' => 'header_edit_all',
'attributes' => 'onclick="Backend.getScrollOffset()" accesskey="e"'
)
),
'operations' => array(
'edit' => array(
'href' => 'act=edit',
'icon' => 'edit.svg'
),
'copy' => array(
'href' => 'act=copy',
'icon' => 'copy.svg'
),
'delete' => array(
'href' => 'act=delete',
'icon' => 'delete.svg',
'attributes' => 'onclick="if(!confirm(\'' . ($GLOBALS['TL_LANG']['MSC']['deleteConfirm'] ?? null) . '\'))return false;Backend.getScrollOffset()"'
),
'show' => array(
'href' => 'act=show',
'icon' => 'show.svg',
'attributes' => 'style="margin-right:3px"'
),
)
),
'palettes' => array(
'__selector__' => array('addSubpalette'),
'default' => '{first_legend},title,selectField,checkboxField,multitextField;{second_legend},addSubpalette'
),
'subpalettes' => array(
'addSubpalette' => 'textareaField',
),
'fields' => array(
'id' => array(
'sql' => "int(10) unsigned NOT NULL auto_increment"
),
'tstamp' => array(
'sql' => "int(10) unsigned NOT NULL default '0'"
),
'title' => array(
'inputType' => 'text',
'exclude' => true,
'search' => true,
'filter' => true,
'sorting' => true,
'flag' => DataContainer::SORT_INITIAL_LETTER_ASC,
'eval' => array('mandatory' => true, 'maxlength' => 255, 'tl_class' => 'w50'),
'sql' => "varchar(255) NOT NULL default ''"
),
'selectField' => array(
'inputType' => 'select',
'exclude' => true,
'search' => true,
'filter' => true,
'sorting' => true,
'reference' => &$GLOBALS['TL_LANG']['tl_arch_projects'],
'options' => array('firstoption', 'secondoption'),
//'foreignKey' => 'tl_user.name',
//'options_callback' => array('CLASS', 'METHOD'),
'eval' => array('includeBlankOption' => true, 'tl_class' => 'w50'),
'sql' => "varchar(255) NOT NULL default ''",
//'relation' => array('type' => 'hasOne', 'load' => 'lazy')
),
'checkboxField' => array(
'inputType' => 'select',
'exclude' => true,
'search' => true,
'filter' => true,
'sorting' => true,
'reference' => &$GLOBALS['TL_LANG']['tl_arch_projects'],
'options' => array('firstoption', 'secondoption'),
//'foreignKey' => 'tl_user.name',
//'options_callback' => array('CLASS', 'METHOD'),
'eval' => array('includeBlankOption' => true, 'chosen' => true, 'tl_class' => 'w50'),
'sql' => "varchar(255) NOT NULL default ''",
//'relation' => array('type' => 'hasOne', 'load' => 'lazy')
),
'multitextField' => array(
'inputType' => 'text',
'exclude' => true,
'search' => true,
'filter' => true,
'sorting' => true,
'eval' => array('multiple' => true, 'size' => 4, 'decodeEntities' => true, 'tl_class' => 'w50'),
'sql' => "varchar(255) NOT NULL default ''"
),
'addSubpalette' => array(
'exclude' => true,
'inputType' => 'checkbox',
'eval' => array('submitOnChange' => true, 'tl_class' => 'w50 clr'),
'sql' => "char(1) NOT NULL default ''"
),
'textareaField' => array(
'inputType' => 'textarea',
'exclude' => true,
'search' => true,
'filter' => true,
'sorting' => true,
'eval' => array('rte' => 'tinyMCE', 'tl_class' => 'clr'),
'sql' => 'text NULL'
)
)
);

20
contao/dca/tl_module.php Normal file
View File

@ -0,0 +1,20 @@
<?php
declare(strict_types=1);
/*
* This file is part of ContaoArchitectureProjectsBundle.
*
* (c) Stephan Gieb 2025 <stephan.gieb@yupdesign.de>
* @license GPL-3.0-or-later
* For the full copyright and license information,
* please view the LICENSE file that was distributed with this source code.
* @link https://github.com/yupdesign/contao-architecture-projects-bundle
*/
use Yupdesign\ContaoArchitectureProjectsBundle\Controller\FrontendModule\ArchListController;
/**
* Frontend modules
*/
$GLOBALS['TL_DCA']['tl_module']['palettes'][ArchListController::TYPE] = '{title_legend},name,headline,type;{template_legend:hide},customTpl;{protected_legend:hide},protected;{expert_legend:hide},guests,cssID';

View File

@ -0,0 +1,23 @@
<?php
declare(strict_types=1);
/*
* This file is part of ContaoArchitectureProjectsBundle.
*
* (c) Stephan Gieb 2025 <stephan.gieb@yupdesign.de>
* @license GPL-3.0-or-later
* For the full copyright and license information,
* please view the LICENSE file that was distributed with this source code.
* @link https://github.com/yupdesign/contao-architecture-projects-bundle
*/
/**
* Miscellaneous
*/
//$GLOBALS['TL_LANG']['MSC'][''] = '';
/**
* Errors
*/
//$GLOBALS['TL_LANG']['ERR'][''] = '';

View File

@ -0,0 +1,28 @@
<?php
declare(strict_types=1);
/*
* This file is part of ContaoArchitectureProjectsBundle.
*
* (c) Stephan Gieb 2025 <stephan.gieb@yupdesign.de>
* @license GPL-3.0-or-later
* For the full copyright and license information,
* please view the LICENSE file that was distributed with this source code.
* @link https://github.com/yupdesign/contao-architecture-projects-bundle
*/
use Yupdesign\ContaoArchitectureProjectsBundle\Controller\FrontendModule\ArchListController;
/**
* Backend modules
*/
$GLOBALS['TL_LANG']['MOD']['architecture_projects'] = 'Referenzen';
$GLOBALS['TL_LANG']['MOD']['arch_projects'] = ['Projekte', 'Übersicht über Projekte'];
/**
* Frontend modules
*/
$GLOBALS['TL_LANG']['FMD']['architecture_projects'] = 'Referenzen';
$GLOBALS['TL_LANG']['FMD'][ArchListController::TYPE] = ['Projektliste', 'Gibt eine Übersicht über alle veröffentlichten Projekte aus.'];

View File

@ -0,0 +1,53 @@
<?php
declare(strict_types=1);
/*
* This file is part of ContaoArchitectureProjectsBundle.
*
* (c) Stephan Gieb 2025 <stephan.gieb@yupdesign.de>
* @license GPL-3.0-or-later
* For the full copyright and license information,
* please view the LICENSE file that was distributed with this source code.
* @link https://github.com/yupdesign/contao-architecture-projects-bundle
*/
/**
* Legends
*/
$GLOBALS['TL_LANG']['tl_arch_projects']['first_legend'] = "Basis Einstellungen";
$GLOBALS['TL_LANG']['tl_arch_projects']['second_legend'] = "Erweiterte Einstellungen";
/**
* Global operations
*/
$GLOBALS['TL_LANG']['tl_arch_projects']['new'] = ["Neu", "Ein neues Element anlegen"];
/**
* Operations
*/
$GLOBALS['TL_LANG']['tl_arch_projects']['edit'] = "Datensatz mit ID: %s bearbeiten";
$GLOBALS['TL_LANG']['tl_arch_projects']['copy'] = "Datensatz mit ID: %s kopieren";
$GLOBALS['TL_LANG']['tl_arch_projects']['delete'] = "Datensatz mit ID: %s löschen";
$GLOBALS['TL_LANG']['tl_arch_projects']['show'] = "Datensatz mit ID: %s ansehen";
/**
* Fields
*/
$GLOBALS['TL_LANG']['tl_arch_projects']['title'] = ["Titel", "Geben Sie den Titel ein"];
$GLOBALS['TL_LANG']['tl_arch_projects']['selectField'] = ["Select Feld", "Wählen Sie aus."];
$GLOBALS['TL_LANG']['tl_arch_projects']['checkboxField'] = ["Chosen Feld", "Wählen Sie aus."];
$GLOBALS['TL_LANG']['tl_arch_projects']['multitextField'] = ["Multitext Feld", "Geben Sie die Werte ein"];
$GLOBALS['TL_LANG']['tl_arch_projects']['addSubpalette'] = ["Erweiterte Einstellungen aktivieren", "Hier können Sie die erweiterten Einstellungen aktivieren."];
$GLOBALS['TL_LANG']['tl_arch_projects']['textareaField'] = ["Textarea", "Geben Sie einen Text ein"];
/**
* References
*/
$GLOBALS['TL_LANG']['tl_arch_projects']['firstoption'] = "Erste Option";
$GLOBALS['TL_LANG']['tl_arch_projects']['secondoption'] = "Zweite Option";
/**
* Buttons
*/
$GLOBALS['TL_LANG']['tl_arch_projects']['customButton'] = "Custom Routine starten";

View File

@ -0,0 +1,8 @@
<?php $this->extend('block_searchable'); ?>
<?php $this->block('content'); ?>
<h3><?= $this->helloTitle ?></h3>
<p><?= $this->helloText ?></p>
<?php $this->endblock(); ?>

BIN
docs/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.0 KiB

1
public/css/styles.css Normal file
View File

@ -0,0 +1 @@
/** Still empty stylesheet **/

1
public/js/script.js Normal file
View File

@ -0,0 +1 @@
/** Still empty script file **/

View File

@ -0,0 +1,49 @@
<?php
declare(strict_types=1);
/*
* This file is part of ContaoArchitectureProjectsBundle.
*
* (c) Stephan Gieb 2025 <stephan.gieb@yupdesign.de>
* @license GPL-3.0-or-later
* For the full copyright and license information,
* please view the LICENSE file that was distributed with this source code.
* @link https://github.com/yupdesign/contao-architecture-projects-bundle
*/
namespace Yupdesign\ContaoArchitectureProjectsBundle\ContaoManager;
use Yupdesign\ContaoArchitectureProjectsBundle\YupdesignContaoArchitectureProjectsBundle;
use Contao\CoreBundle\ContaoCoreBundle;
use Contao\ManagerPlugin\Bundle\BundlePluginInterface;
use Contao\ManagerPlugin\Bundle\Config\BundleConfig;
use Contao\ManagerPlugin\Bundle\Parser\ParserInterface;
use Contao\ManagerPlugin\Routing\RoutingPluginInterface;
use Symfony\Component\Config\Loader\LoaderResolverInterface;
use Symfony\Component\HttpKernel\KernelInterface;
use Symfony\Component\Routing\RouteCollection;
class Plugin implements BundlePluginInterface, RoutingPluginInterface
{
/**
* @return array
*/
public function getBundles(ParserInterface $parser)
{
return [
BundleConfig::create(YupdesignContaoArchitectureProjectsBundle::class)
->setLoadAfter([ContaoCoreBundle::class]),
];
}
/**
* @return RouteCollection|null
*/
public function getRouteCollection(LoaderResolverInterface $resolver, KernelInterface $kernel)
{
return $resolver
->resolve(__DIR__.'/../Controller')
->load(__DIR__.'/../Controller');
}
}

View File

@ -0,0 +1,123 @@
<?php
declare(strict_types=1);
/*
* This file is part of ContaoArchitectureProjectsBundle.
*
* (c) Stephan Gieb 2025 <stephan.gieb@yupdesign.de>
* @license GPL-3.0-or-later
* For the full copyright and license information,
* please view the LICENSE file that was distributed with this source code.
* @link https://github.com/yupdesign/contao-architecture-projects-bundle
*/
namespace Yupdesign\ContaoArchitectureProjectsBundle\Controller\FrontendModule;
use Contao\CoreBundle\Controller\FrontendModule\AbstractFrontendModuleController;
use Contao\CoreBundle\DependencyInjection\Attribute\AsFrontendModule;
use Contao\CoreBundle\Framework\ContaoFramework;
use Contao\CoreBundle\Routing\ScopeMatcher;
use Contao\Date;
use Contao\FrontendUser;
use Contao\ModuleModel;
use Contao\PageModel;
use Contao\Template;
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Result;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\Session\Session;
use Symfony\Component\Security\Core\Security;
use Symfony\Contracts\Translation\TranslatorInterface;
#[AsFrontendModule(category: 'architecture_projects', template: 'mod_arch_list')]
class ArchListController extends AbstractFrontendModuleController
{
public const TYPE = 'arch_list';
protected ?PageModel $page;
/**
* This method extends the parent __invoke method,
* its usage is usually not necessary.
*/
public function __invoke(Request $request, ModuleModel $model, string $section, array $classes = null, PageModel $page = null): Response
{
// Get the page model
$this->page = $page;
$scopeMatcher = $this->container->get('contao.routing.scope_matcher');
if ($this->page instanceof PageModel && $scopeMatcher->isFrontendRequest($request)) {
$this->page->loadDetails();
}
return parent::__invoke($request, $model, $section, $classes);
}
/**
* Lazyload services.
*/
public static function getSubscribedServices(): array
{
$services = parent::getSubscribedServices();
$services['contao.framework'] = ContaoFramework::class;
$services['database_connection'] = Connection::class;
$services['contao.routing.scope_matcher'] = ScopeMatcher::class;
$services['security.helper'] = Security::class;
$services['translator'] = TranslatorInterface::class;
return $services;
}
protected function getResponse(Template $template, ModuleModel $model, Request $request): Response
{
$userFirstname = 'DUDE';
$user = $this->container->get('security.helper')->getUser();
// Get the logged in frontend user... if there is one
if ($user instanceof FrontendUser) {
$userFirstname = $user->firstname;
}
/** @var Session $session */
$session = $request->getSession();
$bag = $session->getBag('contao_frontend');
$bag->set('foo', 'bar');
/** @var Date $dateAdapter */
$dateAdapter = $this->container->get('contao.framework')->getAdapter(Date::class);
$intWeekday = $dateAdapter->parse('w');
$translator = $this->container->get('translator');
$strWeekday = $translator->trans('DAYS.'.$intWeekday, [], 'contao_default');
$arrGuests = [];
// Get the database connection
$db = $this->container->get('database_connection');
/** @var Result $stmt */
$stmt = $db->executeQuery('SELECT * FROM tl_member WHERE gender = ? ORDER BY lastname', ['female']);
while (false !== ($row = $stmt->fetchAssociative())) {
$arrGuests[] = $row['firstname'];
}
$template->helloTitle = sprintf(
'Hi %s, and welcome to the "Hello World Module". Today is %s.',
$userFirstname,
$strWeekday,
);
$template->helloText = '';
if (!empty($arrGuests)) {
$template->helloText = 'Our guests today are: '.implode(', ', $arrGuests);
}
return $template->getResponse();
}
}

View File

@ -0,0 +1,57 @@
<?php
declare(strict_types=1);
/*
* This file is part of ContaoArchitectureProjectsBundle.
*
* (c) Stephan Gieb 2025 <stephan.gieb@yupdesign.de>
* @license GPL-3.0-or-later
* For the full copyright and license information,
* please view the LICENSE file that was distributed with this source code.
* @link https://github.com/yupdesign/contao-architecture-projects-bundle
*/
namespace Yupdesign\ContaoArchitectureProjectsBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use Twig\Environment as Twig;
#[Route('/my_custom', name: MyCustomController::class, defaults: ['_scope' => 'frontend', '_token_check' => true])]
class MyCustomController extends AbstractController
{
public function __construct(
private readonly Twig $twig,
) {
}
public function __invoke(): Response
{
$animals = [
[
'species' => 'dogs',
'color' => 'white',
],
[
'species' => 'birds',
'color' => 'black',
], [
'species' => 'cats',
'color' => 'pink',
], [
'species' => 'cows',
'color' => 'yellow',
],
];
return new Response($this->twig->render(
'@YupdesignContaoArchitectureProjects/MyCustom/my_custom.html.twig',
[
'animals' => $animals,
]
));
}
}

View File

@ -0,0 +1,45 @@
<?php
declare(strict_types=1);
/*
* This file is part of ContaoArchitectureProjectsBundle.
*
* (c) Stephan Gieb 2025 <stephan.gieb@yupdesign.de>
* @license GPL-3.0-or-later
* For the full copyright and license information,
* please view the LICENSE file that was distributed with this source code.
* @link https://github.com/yupdesign/contao-architecture-projects-bundle
*/
namespace Yupdesign\ContaoArchitectureProjectsBundle\DataContainer;
use Contao\CoreBundle\DependencyInjection\Attribute\AsCallback;
use Contao\CoreBundle\Framework\ContaoFramework;
use Contao\DataContainer;
use Contao\Input;
use Contao\System;
#[AsCallback(table: 'tl_arch_projects', target: 'edit.buttons', priority: 100)]
class ArchProjects
{
public function __construct(
private readonly ContaoFramework $framework,
) {
}
public function __invoke(array $arrButtons, DataContainer $dc): array
{
$inputAdapter = $this->framework->getAdapter(Input::class);
$systemAdapter = $this->framework->getAdapter(System::class);
$systemAdapter->loadLanguageFile('tl_arch_projects');
if ('edit' === $inputAdapter->get('act')) {
$arrButtons['customButton'] = '<button type="submit" name="customButton" id="customButton" class="tl_submit customButton" accesskey="x">'.$GLOBALS['TL_LANG']['tl_arch_projects']['customButton'].'</button>';
}
return $arrButtons;
}
}

View File

@ -0,0 +1,44 @@
<?php
declare(strict_types=1);
/*
* This file is part of ContaoArchitectureProjectsBundle.
*
* (c) Stephan Gieb 2025 <stephan.gieb@yupdesign.de>
* @license GPL-3.0-or-later
* For the full copyright and license information,
* please view the LICENSE file that was distributed with this source code.
* @link https://github.com/yupdesign/contao-architecture-projects-bundle
*/
namespace Yupdesign\ContaoArchitectureProjectsBundle\DependencyInjection;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\ConfigurationInterface;
class Configuration implements ConfigurationInterface
{
public const ROOT_KEY = 'yupdesign_contao_architecture_projects';
public function getConfigTreeBuilder(): TreeBuilder
{
$treeBuilder = new TreeBuilder(self::ROOT_KEY);
$treeBuilder->getRootNode()
->children()
->arrayNode('foo')
->addDefaultsIfNotSet()
->children()
->scalarNode('bar')
->cannotBeEmpty()
->defaultValue('***')
->end()
->end()
->end() // end foo
->end()
;
return $treeBuilder;
}
}

View File

@ -0,0 +1,54 @@
<?php
declare(strict_types=1);
/*
* This file is part of ContaoArchitectureProjectsBundle.
*
* (c) Stephan Gieb 2025 <stephan.gieb@yupdesign.de>
* @license GPL-3.0-or-later
* For the full copyright and license information,
* please view the LICENSE file that was distributed with this source code.
* @link https://github.com/yupdesign/contao-architecture-projects-bundle
*/
namespace Yupdesign\ContaoArchitectureProjectsBundle\DependencyInjection;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Extension\Extension;
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
class YupdesignContaoArchitectureProjectsExtension extends Extension
{
/**
* {@inheritdoc}
*/
public function getAlias(): string
{
return Configuration::ROOT_KEY;
}
/**
* @throws \Exception
*/
public function load(array $configs, ContainerBuilder $container): void
{
$configuration = new Configuration();
$config = $this->processConfiguration($configuration, $configs);
$loader = new YamlFileLoader(
$container,
new FileLocator(__DIR__.'/../../config')
);
$loader->load('parameters.yaml');
$loader->load('services.yaml');
$loader->load('listener.yaml');
$rootKey = $this->getAlias();
$container->setParameter($rootKey.'.foo.bar', $config['foo']['bar']);
}
}

View File

@ -0,0 +1,22 @@
<?php
declare(strict_types=1);
/*
* This file is part of ContaoArchitectureProjectsBundle.
*
* (c) Stephan Gieb 2025 <stephan.gieb@yupdesign.de>
* @license GPL-3.0-or-later
* For the full copyright and license information,
* please view the LICENSE file that was distributed with this source code.
* @link https://github.com/yupdesign/contao-architecture-projects-bundle
*/
namespace Yupdesign\ContaoArchitectureProjectsBundle\Model;
use Contao\Model;
class ArchProjectsModel extends Model
{
protected static $strTable = 'tl_arch_projects';
}

View File

@ -0,0 +1,40 @@
<?php
declare(strict_types=1);
/*
* This file is part of ContaoArchitectureProjectsBundle.
*
* (c) Stephan Gieb 2025 <stephan.gieb@yupdesign.de>
* @license GPL-3.0-or-later
* For the full copyright and license information,
* please view the LICENSE file that was distributed with this source code.
* @link https://github.com/yupdesign/contao-architecture-projects-bundle
*/
namespace Yupdesign\ContaoArchitectureProjectsBundle;
use Yupdesign\ContaoArchitectureProjectsBundle\DependencyInjection\YupdesignContaoArchitectureProjectsExtension;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\Bundle\Bundle;
class YupdesignContaoArchitectureProjectsBundle extends Bundle
{
public function getPath(): string
{
return \dirname(__DIR__);
}
public function getContainerExtension(): YupdesignContaoArchitectureProjectsExtension
{
return new YupdesignContaoArchitectureProjectsExtension();
}
/**
* {@inheritdoc}
*/
public function build(ContainerBuilder $container): void
{
parent::build($container);
}
}

View File

@ -0,0 +1,15 @@
{% block body %}
<h1>Welcome to our homepage</h1>
<p>We are purchasing</p>
{% for animal in animals %}
<ul>
<li> {{ animal.color }} {{ animal.species }}</li>
</ul>
{% endfor %}
{% endblock %}

View File

@ -0,0 +1,52 @@
<?php
/*
* This file is part of ContaoArchitectureProjectsBundle.
*
* (c) Stephan Gieb 2025 <stephan.gieb@yupdesign.de>
* @license GPL-3.0-or-later
* For the full copyright and license information,
* please view the LICENSE file that was distributed with this source code.
* @link https://github.com/yupdesign/contao-architecture-projects-bundle
*/
declare(strict_types=1);
namespace Yupdesign\ContaoArchitectureProjectsBundle\Tests\ContaoManager;
use Contao\CoreBundle\ContaoCoreBundle;
use Contao\ManagerPlugin\Bundle\Config\BundleConfig;
use Contao\ManagerPlugin\Bundle\Parser\DelegatingParser;
use Contao\TestCase\ContaoTestCase;
use Yupdesign\ContaoArchitectureProjectsBundle\ContaoManager\Plugin;
use Yupdesign\ContaoArchitectureProjectsBundle\YupdesignContaoArchitectureProjectsBundle;
/**
* @package Yupdesign\ContaoArchitectureProjectsBundle\Tests\ContaoManager
*/
class PluginTest extends ContaoTestCase
{
/**
* Test Contao manager plugin class instantiation
*/
public function testInstantiation(): void
{
$this->assertInstanceOf(Plugin::class, new Plugin());
}
/**
* Test returns the bundles
*/
public function testGetBundles(): void
{
$plugin = new Plugin();
/** @var array $bundles */
$bundles = $plugin->getBundles(new DelegatingParser());
$this->assertCount(1, $bundles);
$this->assertInstanceOf(BundleConfig::class, $bundles[0]);
$this->assertSame(YupdesignContaoArchitectureProjectsBundle::class, $bundles[0]->getName());
$this->assertSame([ContaoCoreBundle::class], $bundles[0]->getLoadAfter());
}
}

View File

@ -0,0 +1,6 @@
{
"require": {
"phpunit/phpunit": "^9.5",
"contao/test-case": "^5.0"
}
}

1807
tools/phpunit/composer.lock generated Normal file

File diff suppressed because it is too large Load Diff