/** * Reset the property's storage fields. * * @param mixed $val The value to set as field value. * @return PropertyField[] */ private function generateFields($val) { $this->fields = []; if ($this->l10n()) { $translator = TranslationConfig::instance(); foreach ($translator->availableLanguages() as $langCode) { $ident = sprintf('%1$s_%2$s', $this->ident(), $langCode); $field = new PropertyField(); $field->setData(['ident' => $ident, 'sqlType' => $this->sqlType(), 'sqlPdoType' => $this->sqlPdoType(), 'extra' => $this->sqlExtra(), 'val' => $this->fieldVal($langCode, $val), 'defaultVal' => null, 'allowNull' => $this->allowNull()]); $this->fields[$langCode] = $field; } } else { $field = new PropertyField(); $field->setData(['ident' => $this->ident(), 'sqlType' => $this->sqlType(), 'sqlPdoType' => $this->sqlPdoType(), 'extra' => $this->sqlExtra(), 'val' => $this->storageVal($val), 'defaultVal' => null, 'allowNull' => $this->allowNull()]); $this->fields[] = $field; } return $this->fields; }