From e5be42a6428022e7b5f19b5fb323690773b91b83 Mon Sep 17 00:00:00 2001 From: gggeek Date: Thu, 15 Apr 2021 14:58:17 +0000 Subject: [PATCH] clean up formatting, comments and docs --- README.md | 4 ++-- Resources/config/ez_field_templates.yml | 2 +- Resources/config/services.yml | 2 +- Resources/views/fields/ezoption.html.twig | 2 +- USAGE.md | 24 +++++++++---------- composer.json | 14 +++++------ .../FieldType/Option/OptionConverter.php | 5 ---- eZ/Publish/FieldType/Option/OptionElement.php | 5 ---- eZ/Publish/FieldType/Option/Type.php | 7 ++---- eZ/Publish/FieldType/Option/Value.php | 5 ---- 10 files changed, 25 insertions(+), 45 deletions(-) diff --git a/README.md b/README.md index dc71b07..c866573 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ KaliopEzOptionFieldTypeBundle -================== +============================= Introduction ------------ @@ -9,7 +9,7 @@ This bundle provides eZOption field type for eZPlatform. Documentation ------------- -Usage examples can be found [here](USAGE.md). +Usage examples can be found [here](USAGE.md). License ------- diff --git a/Resources/config/ez_field_templates.yml b/Resources/config/ez_field_templates.yml index ebc7098..ba9c751 100644 --- a/Resources/config/ez_field_templates.yml +++ b/Resources/config/ez_field_templates.yml @@ -1,4 +1,4 @@ system: default: field_templates: - - {template: KaliopEzOptionFieldTypeBundle:fields:ezoption.html.twig} \ No newline at end of file + - {template: KaliopEzOptionFieldTypeBundle:fields:ezoption.html.twig} diff --git a/Resources/config/services.yml b/Resources/config/services.yml index 42a4d16..a3ed43a 100644 --- a/Resources/config/services.yml +++ b/Resources/config/services.yml @@ -15,4 +15,4 @@ services: ezpublish.fieldType.ezoption.converter: class: Kaliop\EzOptionFieldTypeBundle\eZ\Publish\FieldType\Option\OptionConverter tags: - - { name: ezpublish.storageEngine.legacy.converter, alias: ezoption } \ No newline at end of file + - { name: ezpublish.storageEngine.legacy.converter, alias: ezoption } diff --git a/Resources/views/fields/ezoption.html.twig b/Resources/views/fields/ezoption.html.twig index 1b62725..066e1f1 100644 --- a/Resources/views/fields/ezoption.html.twig +++ b/Resources/views/fields/ezoption.html.twig @@ -22,4 +22,4 @@ {% endspaceless %} -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/USAGE.md b/USAGE.md index ed11353..b3a8720 100644 --- a/USAGE.md +++ b/USAGE.md @@ -1,8 +1,8 @@ Usage -================== +===== Save an ez_option value in eZ Publish 5 ------------- + ```php getUserService(); $contentService = $repository->getContentService(); $locationService = $repository->getLocationService(); $contentTypeService = $repository->getContentTypeService(); - + // Identifying to the repository with a login and a password $user = $userService->loadUserByLogin($login); $repository->setCurrentUser($user); - + // The ContentCreateStruct $contentType = $contentTypeService->loadContentTypeByIdentifier('survey'); $contentCreateStruct = $contentService->newContentCreateStruct($contentType, 'eng-GB'); - + // Create ez option $option = new Option\Value(); $option->setName('Question - saved in eZ 5'); @@ -31,7 +31,7 @@ $option->addOption(new Option\OptionElement('test-2')); $option->addOption(new Option\OptionElement('test-3', null, 1000)); // id = 1000 -> 1000 $option->addOption(new Option\OptionElement('test-4', 10)); // id = -1 -> 1001 $option->addOption(new Option\OptionElement('test-5', 20, 5)); // id = 5 -> 5 - + /* It is equivalent to this code : $options = array( @@ -42,9 +42,9 @@ $options = array( new Option\OptionElement('test-5', 20, 5), ); $option = new Option\Value('Question - saved in eZ 5', $options); - + or - + $options = array( 'test-1', 'test-2', @@ -57,17 +57,15 @@ $options = array( ); $option->addOptions($options); */ - + // Setting the fields values $contentCreateStruct->setField('expiry', new \DateTime()); $contentCreateStruct->setField('question_answers', $option); - + // Setting the Location $locationCreateStruct = $locationService->newLocationCreateStruct(274); - + // Creating and publishing $draft = $contentService->createContent($contentCreateStruct, array( $locationCreateStruct )); $content = $contentService->publishVersion($draft->versionInfo); - ``` - diff --git a/composer.json b/composer.json index 38d06d2..f3f5b18 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,6 @@ { "name": "kaliop/ezoptionfieldtypebundle", - "description": "EzOption FieldType for eZ Publish Platform", + "description": "EzOption FieldType for eZPublishPlatform / eZPlatform", "license": "GPL-2.0", "keywords": ["ezpublish", "ezoption"], "authors": [ @@ -16,10 +16,10 @@ "autoload": { "psr-4": {"Kaliop\\EzOptionFieldTypeBundle\\": ""} }, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/tanoconsulting" - } - ] + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/tanoconsulting" + } + ] } diff --git a/eZ/Publish/FieldType/Option/OptionConverter.php b/eZ/Publish/FieldType/Option/OptionConverter.php index 328c3c4..3c06842 100644 --- a/eZ/Publish/FieldType/Option/OptionConverter.php +++ b/eZ/Publish/FieldType/Option/OptionConverter.php @@ -8,11 +8,6 @@ use eZ\Publish\SPI\Persistence\Content\FieldValue; use eZ\Publish\SPI\Persistence\Content\Type\FieldDefinition; -/** - * Class LegacyConverter - * - * @package Kaliop\EzOptionFieldTypeBundle\eZ\Publish\FieldType\Option - */ class OptionConverter implements Converter { public static function create() diff --git a/eZ/Publish/FieldType/Option/OptionElement.php b/eZ/Publish/FieldType/Option/OptionElement.php index 52be404..b049192 100644 --- a/eZ/Publish/FieldType/Option/OptionElement.php +++ b/eZ/Publish/FieldType/Option/OptionElement.php @@ -2,11 +2,6 @@ namespace Kaliop\EzOptionFieldTypeBundle\eZ\Publish\FieldType\Option; -/** - * Class OptionElement - * - * @package Kaliop\EzOptionFieldTypeBundle\eZ\Publish\FieldType\Option - */ class OptionElement { /** diff --git a/eZ/Publish/FieldType/Option/Type.php b/eZ/Publish/FieldType/Option/Type.php index e39268e..3e8e5f6 100644 --- a/eZ/Publish/FieldType/Option/Type.php +++ b/eZ/Publish/FieldType/Option/Type.php @@ -10,11 +10,8 @@ use eZ\Publish\SPI\FieldType\Value as SPIValue; use eZ\Publish\SPI\Persistence\Content\FieldValue as PersistenceValue; use Kaliop\EzOptionFieldTypeBundle\eZ\Publish\FieldType\Option\Value as OptionValue; -/** - * Class Type - * - * @package Kaliop\EzOptionFieldTypeBundle\eZ\Publish\FieldType\Option - */ + + class Type extends FieldType { /** diff --git a/eZ/Publish/FieldType/Option/Value.php b/eZ/Publish/FieldType/Option/Value.php index f224a16..9558991 100644 --- a/eZ/Publish/FieldType/Option/Value.php +++ b/eZ/Publish/FieldType/Option/Value.php @@ -6,11 +6,6 @@ use eZ\Publish\Core\FieldType\Value as BaseValue; use Symfony\Component\Config\Definition\Exception\DuplicateKeyException; -/** - * Class Value for ezOption field type - * - * @package Kaliop\EzOptionFieldTypeBundle\eZ\Publish\FieldType\Option - */ class Value extends BaseValue {