diff --git a/.php_cs b/.php_cs new file mode 100644 index 0000000..4296475 --- /dev/null +++ b/.php_cs @@ -0,0 +1,24 @@ +setRules([ + '@Symfony' => true, + '@Symfony:risky' => true, + 'concat_space' => ['spacing' => 'one'], + 'array_syntax' => ['syntax' => 'short'], + 'simplified_null_return' => false, + 'phpdoc_align' => false, + 'phpdoc_to_comment' => false, + 'cast_spaces' => false, + 'blank_line_after_opening_tag' => false, + 'single_blank_line_before_namespace' => false, + 'space_after_semicolon' => false, + 'yoda_style' => false, + 'no_break_comment' => false, + ]) + ->setRiskyAllowed(true) + ->setFinder( + PhpCsFixer\Finder::create() + ->in(__DIR__ . '/src') + ->files()->name('*.php') + ) +; diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..e4df7d6 --- /dev/null +++ b/LICENSE @@ -0,0 +1,7 @@ +Copyright 2018 Mateusz Bieniek + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..e78ef9a --- /dev/null +++ b/README.md @@ -0,0 +1,15 @@ +# ezplatform-form-builder-country-field +## Description +Bundle provides country selection field for the Form Builder in eZ Platform EE. + +## Installation +### 1. Enable EzPublishLegacyBundle and EzSystemsEzPlatformXmlTextFieldTypeBundle +Edit `app/AppKernel.php`, and add +``` +new MateuszBieniek\EzPlatformFormBuilderCountryBundle\EzPlatformFormBuilderCountryBundle(), +``` +at the end of the `$bundles` array. +### 2. Install `mateuszbieniek/ezplatform-form-builder-country-field` +``` +composer require mateuszbieniek/ezplatform-form-builder-country-field +``` diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..9723aa8 --- /dev/null +++ b/composer.json @@ -0,0 +1,35 @@ +{ + "name": "mateuszbieniek/ezplatform-form-builder-country-field", + "license": "MIT", + "type": "ezplatform-bundle", + "description": "Bundle providing Country select field for the eZ Platform EE Form Builder", + "repositories": [ + { + "type": "composer", + "url": "https://updates.ez.no/ttl" + } + ], + "autoload": { + "psr-4": { + "MateuszBieniek\\EzPlatformFormBuilderCountryBundle\\": "src/bundle/", + "MateuszBieniek\\EzPlatformFormBuilderCountry\\": "src/lib/" + } + }, + "autoload-dev": { + "psr-4": { + "MateuszBieniek\\EzPlatformFormBuilderCountryBundle\\Tests\\": "src/bundle/Tests" + } + }, + "require": { + "php": ">=7.1", + "ezsystems/ezpublish-kernel": "^7.3", + "ezsystems/ezplatform-form-builder": "^1.0" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "2.7.*", + "phpunit/phpunit": "~7.0" + }, + "scripts": { + "fix-cs": "@php ./vendor/bin/php-cs-fixer fix -v --show-progress=estimating" + } +} diff --git a/src/bundle/DependencyInjection/EzPlatformFormBuilderCountryExtension.php b/src/bundle/DependencyInjection/EzPlatformFormBuilderCountryExtension.php new file mode 100644 index 0000000..5891937 --- /dev/null +++ b/src/bundle/DependencyInjection/EzPlatformFormBuilderCountryExtension.php @@ -0,0 +1,41 @@ +load('services.yml'); + } + + /** + * {@inheritdoc} + */ + public function prepend(ContainerBuilder $container): void + { + $config = Yaml::parseFile( + __DIR__ . '/../Resources/config/config.yml' + ); + + foreach ($config as $extension => $settings) { + $container->prependExtensionConfig($extension, $settings); + } + } +} diff --git a/src/bundle/EzPlatformFormBuilderCountryBundle.php b/src/bundle/EzPlatformFormBuilderCountryBundle.php new file mode 100644 index 0000000..b5c11d5 --- /dev/null +++ b/src/bundle/EzPlatformFormBuilderCountryBundle.php @@ -0,0 +1,18 @@ +getBlockPrefix(); + } + + public function getBlockPrefix() + { + return 'mateuszbieniek_country'; + } + + /** + * {@inheritdoc} + */ + public function getParent(): string + { + return CountryType::class; + } +} diff --git a/src/lib/FormBuilder/Field/Mapper/CountryMapper.php b/src/lib/FormBuilder/Field/Mapper/CountryMapper.php new file mode 100644 index 0000000..0d8551e --- /dev/null +++ b/src/lib/FormBuilder/Field/Mapper/CountryMapper.php @@ -0,0 +1,23 @@ +getName(); + + return $options; + } +}