Skip to content

Commit 0957d56

Browse files
author
Mario Blazek
committed
Removed hardcoded values 2.0
1 parent 7be0fb7 commit 0957d56

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

bundle/DependencyInjection/ConfigurationConstants.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,6 @@ class ConfigurationConstants
1313
const DEFAULT_VARIABLES = 'default_variables';
1414

1515
const SETTINGS_ROOT = 'netgen_information_collection';
16+
17+
const SETTINGS_DEFAULT = 'default';
1618
}

bundle/Factory/EmailDataFactory.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
use eZ\Publish\Core\Helper\FieldHelper;
77
use eZ\Publish\Core\Helper\TranslationHelper;
88
use eZ\Publish\API\Repository\Values\Content\Content;
9+
use Netgen\Bundle\InformationCollectionBundle\DependencyInjection\ConfigurationConstants;
910
use Netgen\Bundle\InformationCollectionBundle\Value\EmailData;
1011
use Netgen\Bundle\InformationCollectionBundle\Constants;
1112

@@ -87,7 +88,7 @@ protected function resolve(Content $content, $field, $property = Constants::FIEL
8788

8889
return $fieldValue->value->$property;
8990
} else {
90-
return $this->config['default_variables'][$field];
91+
return $this->config[ConfigurationConstants::DEFAULT_VARIABLES][$field];
9192
}
9293
}
9394

@@ -104,12 +105,12 @@ protected function resolveTemplate($content)
104105

105106
$contentTypeIdentifier = $contentType->identifier;
106107

107-
if (array_key_exists($contentTypeIdentifier, $this->config['templates'])) {
108+
if (array_key_exists($contentTypeIdentifier, $this->config[ConfigurationConstants::TEMPLATES])) {
108109

109-
return $this->config['templates'][$contentTypeIdentifier];
110+
return $this->config[ConfigurationConstants::TEMPLATES][$contentTypeIdentifier];
110111

111112
}
112113

113-
return $this->config['templates']['default'];
114+
return $this->config[ConfigurationConstants::TEMPLATES][ConfigurationConstants::SETTINGS_DEFAULT];
114115
}
115116
}

bundle/FieldHandler/FieldHandlerRegistry.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public function addHandler(CustomFieldHandlerInterface $handler)
3535
/**
3636
* @param Value $value
3737
*
38-
* @return string
38+
* @return CustomFieldHandlerInterface|null
3939
*/
4040
public function handle(Value $value)
4141
{

0 commit comments

Comments
 (0)