Conversation
…ample, form layout class
…n (probably custom) template
| foreach ($this->model as $m) { | ||
| /** @var Card */ | ||
| $c = $this->cardHolder->add(Factory::factory([$this->card], ['useLabel' => $this->useLabel, 'useTable' => $this->useTable])); | ||
| $c = $this->cardHolder->add(Factory::factory((array) $this->card, ['useLabel' => $this->useLabel, 'useTable' => $this->useTable])); |
There was a problem hiding this comment.
never use (array) cast, change the def. value to be an array seed instead
There was a problem hiding this comment.
Ok, will work on that a bit more probably tomorrow. Looks like there are more seed related things to fix in this (and Card) classes for consistency with other views and also to ease extending.
| if (is_array($tag) && $value === null) { | ||
| foreach ($tag as $k => $v) { | ||
| $this->_setOrAppend($k, $v, $encodeHtml, $append, false); | ||
| $this->_setOrAppend($k, (string) $v, $encodeHtml, $append, false); |
There was a problem hiding this comment.
never cast to a string, string type is required
There was a problem hiding this comment.
But if you use ->set($model), then it will try to set model id which is integer into template too.
There was a problem hiding this comment.
see l153/typecasting above, this is already fully handled when set thru model, we cannot do it with array, as php type itself is not enought to determine DBAL/typecasting type, since #1987 we format int using UI persistence config, so (string) will not produce desired output
| * Add fields label and value to section. | ||
| */ | ||
| private function addSectionFields(Model $model, array $fields, bool $useLabel = false): void | ||
| protected function addSectionFields(Model $model, array $fields, bool $useLabel = false): void |
There was a problem hiding this comment.
Private methods are often added as the API might not be well defined. If private, we do not have to care, but if protected, we need to support the API in a long term. Please confirm you understand this and also there are no simillar private methods in other components.
Multiple improvements for Card and CardDeck - see description of commits.
Also adds additional demo how we can create CardDeck with custom Cards.
