nathan

So, is it normal that ModelAdmin bypasses canPublish?

nathan

Or at least standardizing the way you find child fields. Some are FieldList, others are Fields, and others are Children.

nathan

Thanks. A "here's ALL the fields" method would save so much time.

nathan

Best I have, assuming we're in the CMS on a SiteTree object:

  1. foreach ($fields->findOrMakeTab('Root.Main')->FieldList() as $field) {
  2. if ($field->isComposite()) {
  3. if (!$field->FieldList()->count()) {
  4. $fields->removeByName($field->getName());
  5. }
  6. }
  7. }
nathan

Is there any quick way to remove empty composite fields?

nathan

so if I'm understanding this correctly, defaultItems is basically what you warned against here: 😂

Show 1 attachment(s)
Sam Minne

so youd wind up increasing the coupling between the ORM and the form system, having different kinds of setValue() calls. It would get quite messy and generally be a step backward.

Hide attachment content