From f4667031dd99b1faabc5afafea530ec132170f0d Mon Sep 17 00:00:00 2001 From: Kelsey Martens Date: Fri, 16 Feb 2018 10:11:35 -0600 Subject: [PATCH] v2.0.0-beta.9 --- CHANGELOG.md | 8 ++++++++ composer.json | 2 +- .../Composer/Components/AbstractField.php | 2 +- .../Components/Fields/DynamicRecipientField.php | 16 +++++++++++++++- .../templates/bootstrap/submissions.html | 2 +- .../templates/bootstrap/view_submission.html | 2 +- 6 files changed, 27 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 703b9dc4a..5613f505f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Solspace Freeform Changelog +## 2.0.0-beta.9 - 2018-02-16 +### Changed +- Updated Dynamic Recipients fields to allow multiple email addresses per option (separated by commas). + +### Fixed +- Fixed a bug where radio fields would not display errors if left empty. +- Fixed a bug where the demo templates errored on submission views after Craft 3 RC 10 update. + ## 2.0.0-beta.8 - 2018-02-14 ### Fixed - Fixed a bug where the CP Submissions list page broke after Craft 3 RC 10 update. diff --git a/composer.json b/composer.json index 660e70e7c..9e47acde2 100644 --- a/composer.json +++ b/composer.json @@ -1,7 +1,7 @@ { "name": "solspace/craft3-freeform", "description": "The most intuitive and powerful form builder for Craft.", - "version": "2.0.0-beta.8", + "version": "2.0.0-beta.9", "type": "craft-plugin", "minimum-stability": "dev", "authors": [ diff --git a/src/Library/Composer/Components/AbstractField.php b/src/Library/Composer/Components/AbstractField.php index 321819a39..a5de62e00 100644 --- a/src/Library/Composer/Components/AbstractField.php +++ b/src/Library/Composer/Components/AbstractField.php @@ -691,7 +691,7 @@ protected function validate(): array if (empty($value)) { $errors[] = $this->translate('This field is required'); } - } else if ('' === $value) { + } else if (null === $value || '' === $value) { $errors[] = $this->translate('This field is required'); } } diff --git a/src/Library/Composer/Components/Fields/DynamicRecipientField.php b/src/Library/Composer/Components/Fields/DynamicRecipientField.php index 2bcb9e4c1..3a62f62f3 100644 --- a/src/Library/Composer/Components/Fields/DynamicRecipientField.php +++ b/src/Library/Composer/Components/Fields/DynamicRecipientField.php @@ -24,6 +24,14 @@ class DynamicRecipientField extends SelectField implements RecipientInterface, O /** @var bool */ protected $showAsRadio; + /** + * @return string + */ + public static function getFieldType(): string + { + return FieldInterface::TYPE_DYNAMIC_RECIPIENTS; + } + /** * @return bool */ @@ -88,8 +96,14 @@ public function getRecipients(): array if (null !== $value && array_key_exists($value, $options)) { $option = $options[$value]; + $emails = explode(',', $option->getValue()); + + $batch = []; + foreach ($emails as $email) { + $batch[] = trim($email); + } - return [$option->getLabel() => $option->getValue()]; + return $batch; } return []; diff --git a/src/codepack/templates/bootstrap/submissions.html b/src/codepack/templates/bootstrap/submissions.html index dcc4ea94b..3fa99c1d2 100644 --- a/src/codepack/templates/bootstrap/submissions.html +++ b/src/codepack/templates/bootstrap/submissions.html @@ -40,7 +40,7 @@

{{ form.name }}

{% for submission in submissions %} {{ submission.id }} - {{ submission.status.name }} + {{ submission.statusModel.name }} {{ submission.title }} diff --git a/src/codepack/templates/bootstrap/view_submission.html b/src/codepack/templates/bootstrap/view_submission.html index f19b86000..489c80890 100644 --- a/src/codepack/templates/bootstrap/view_submission.html +++ b/src/codepack/templates/bootstrap/view_submission.html @@ -41,7 +41,7 @@

{{ form.name }} - {{ submission.title }}

- + {% for field in submission.fieldMetadata %}
Status{{ submission.status.name }}{{ submission.statusModel.name }}