deblan.io-murph/core/DependencyInjection/Configuration.php

123 lines
4.6 KiB
PHP
Raw Normal View History

<?php
namespace App\Core\DependencyInjection;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\ConfigurationInterface;
class Configuration implements ConfigurationInterface
{
public function getConfigTreeBuilder(): TreeBuilder
{
2021-06-15 11:49:44 +02:00
$defaultMimetypes = [
'image/png',
'image/jpg',
'image/jpeg',
'image/gif',
2021-06-15 18:54:23 +02:00
'image/svg+xml',
'video/mp4',
'audio/mpeg3',
'audio/x-mpeg-3',
'multipart/x-zip',
'multipart/x-gzip',
2021-06-15 11:49:44 +02:00
'application/pdf',
'application/ogg',
'application/zip',
'application/rar',
'application/x-rar-compressed',
'application/x-zip-compressed',
'application/tar',
'application/x-tar',
2021-06-15 18:54:23 +02:00
'application/x-bzip',
'application/x-bzip2',
'application/x-gzip',
'application/octet-stream',
'application/msword',
2021-06-15 11:49:44 +02:00
'text/plain',
2021-06-15 18:54:23 +02:00
'text/css',
2021-06-15 11:49:44 +02:00
];
$defaultLocked = [
'%kernel.project_dir%/public/uploads',
];
$treeBuilder = new TreeBuilder('core');
$treeBuilder->getRootNode()
->children()
->arrayNode('site')
->children()
->scalarNode('name')
2021-06-15 11:49:44 +02:00
->defaultValue('Murph')
->isRequired()
->cannotBeEmpty()
->end()
->scalarNode('logo')
2021-06-15 11:49:44 +02:00
->defaultValue('build/images/core/logo.svg')
->isRequired()
->cannotBeEmpty()
->end()
2021-05-25 15:20:32 +02:00
->arrayNode('controllers')
->prototype('array')
2021-06-15 11:49:44 +02:00
->children()
->scalarNode('name')
->cannotBeEmpty()
->end()
->scalarNode('action')
->cannotBeEmpty()
->end()
2021-05-25 15:20:32 +02:00
->end()
->end()
->end()
->arrayNode('pages')
->prototype('array')
2021-06-15 11:49:44 +02:00
->children()
->scalarNode('name')
->isRequired()
->cannotBeEmpty()
->end()
->arrayNode('templates')
->prototype('array')
->children()
->scalarNode('name')
->cannotBeEmpty()
->end()
->scalarNode('file')
->cannotBeEmpty()
->end()
->end()
->end()
->end()
->end()
->end()
2021-06-15 11:49:44 +02:00
->end()
->end()
->end()
->arrayNode('file_manager')
->children()
->arrayNode('mimes')
->scalarPrototype()
->end()
->defaultValue($defaultMimetypes)
->end()
->scalarNode('path')
->defaultValue('%kernel.project_dir%/public/uploads')
->cannotBeEmpty()
->end()
->scalarNode('path_uri')
->defaultValue('/uploads')
->cannotBeEmpty()
->end()
->arrayNode('path_locked')
->scalarPrototype()
2021-05-25 15:20:32 +02:00
->end()
2021-06-15 11:49:44 +02:00
->defaultValue($defaultLocked)
->end()
->end()
->end()
->end();
return $treeBuilder;
}
}