From c97553dae14e1de95deb47c1e0c75e3fc1b2a1f3 Mon Sep 17 00:00:00 2001 From: Myles Derham Date: Fri, 8 Jun 2018 09:06:38 +1200 Subject: [PATCH] Remove square brackets from getInputHTML This should be left up to the twig code as it's much easier to add square brackets like this in twig than it is to remove them. --- src/fields/DynamicOptionsField.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/fields/DynamicOptionsField.php b/src/fields/DynamicOptionsField.php index c509a29..08c9f50 100644 --- a/src/fields/DynamicOptionsField.php +++ b/src/fields/DynamicOptionsField.php @@ -124,7 +124,7 @@ public function getInputHtml($value, ElementInterface $element = null): string $variables['element'] = $element; //$variables['model'] = $this->model; - $options = Json::decode('['.Craft::$app->getView()->renderString($this->json, $variables).']', true); + $options = Json::decode(Craft::$app->getView()->renderString($this->json, $variables), true); Craft::$app->getView()->setTemplateMode($oldMode); // Variables to pass down to our field JavaScript to let it namespace properly