verbb / super-table

Super-charge your Craft workflow using Super Table.
MIT License
317 stars 47 forks source link

Fix new static field error when min/max row settings set #516

Closed ttempleton closed 1 year ago

ttempleton commented 1 year ago

This fixes #512 by skipping the ArrayValidator usage in SuperTableField::validateBlocks() if the Super Table field is set to be static. The error causing #512 seems to be caused by the $blocks array being empty when saving a new entry, if a static Super Table field wasn't edited. I'm not sure if this would be the preferred solution, though, e.g. you might prefer to unset the field's minRows/maxRows settings if the field is set to be static.

On a related note, it might also be worth hiding the row-related field settings when the field is static, since they're not really relevant in that case; I'll open that as a separate PR in a minute, in case one or the other isn't a preferred solution.

engram-design commented 1 year ago

Thanks Thomas, I think that makes sense to me! Really appreciate the PR.