Hydrating assigned fields into a form builder
Created 7 years ago by edster<?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()
];
}