lewisjenkins / craft-dynamic-fields

Populate Craft fields with dynamic data using the power of Twig.
Other
147 stars 10 forks source link

count(): Argument #1 ($value) must be of type Countable|array #41

Closed tonyclemmey closed 3 years ago

tonyclemmey commented 3 years ago

I guess this is a PHP 8 issue.

TypeError
count(): Argument #1 ($value) must be of type Countable|array, null given

vendor/lewisjenkins/craft-dynamic-fields/src/fields/Multiselect.php

        $options = json_decode('[' . $view->renderString($this->multiselectOptions, $variables) . ']', true);

        $view->setTemplateMode($templateMode);

        return Craft::$app->getView()->renderTemplate('craft-dynamic-fields/_includes/forms/multiselect', [
            'name' => $this->handle,
            'values' => $value,
            'options' => $options,
            'size' => ($this->fieldHeight > 0 ? $this->fieldHeight : count($options))
        ]);