Hydrating assigned fields into a form builder

edster - 2 weeks ago

<?php
/** @var AssignmentInterface $assignment */
            foreach ($profileSection->getEntryStream()->getAssignments() as $assignment) {
                /** @var FieldInterface $field */
                $field = $assignment->getField();
                $fields[$field->getSlug()] = [
                    'label' => $assignment->getLabel() ?? $field->getName(),
                    'required' => $assignment->isRequired(),
                    'type' => $field->getType()->getSlug(),
                    'config' => $field->getConfig()
                ];
            }