src/Command/GetMultiformFromRelation.php
/**
     * Get the multiple form builder from the value.
     *
     * @param FieldRepositoryInterface $fields
     * @param MultipleFormBuilder $forms
     * @return MultipleFormBuilder|null
     */
Get the multiple form builder from the value.
Get the multiple form builder from the value .
public function handle(FieldRepositoryInterface $fields, MultipleFormBuilder $forms, Decorator $decorator)
    {
        if (!$value = $decorator->undecorate($this->fieldType->getValue())) {
            return null;
        }
        foreach ($value as $instance => $entry) {
            if (!$field = $fields->find($this->fieldType->id())) {
                continue;
            }
            $type = $field->getType();
            $type->setPrefix($this->fieldType->getPrefix());
            $form = $type
                ->form($field, $instance)
                ->setEntry($entry);
            $form->setReadOnly($this->fieldType->isReadOnly());
            $forms->addForm($this->fieldType->getFieldName() . '_' . $instance, $form);
        }
        $forms->setOption('success_message', false);
        return $forms;
    }
public function handle ( FieldRepositoryInterface $ fields , MultipleFormBuilder $ forms , Decorator $ decorator ) { if ( ! $ value = $ decorator -> undecorate ( $ this -> fieldType -> getValue ( ) ) ) { return null ; } foreach ( $ value as $ instance => $ entry ) { if ( ! $ field = $ fields -> find ( $ this -> fieldType -> id ( ) ) ) { continue ; } $ type = $ field -> getType ( ) ; $ type -> setPrefix ( $ this -> fieldType -> getPrefix ( ) ) ; $ form = $ type -> form ( $ field , $ instance ) -> setEntry ( $ entry ) ; $ form -> setReadOnly ( $ this -> fieldType -> isReadOnly ( ) ) ; $ forms -> addForm ( $ this -> fieldType -> getFieldName ( ) . '_' . $ instance , $ form ) ; } $ forms -> setOption ( 'success_message' , false ) ; return $ forms ; }
Get the multiple form builder from the value.
Get the multiple form builder from the value .
/* @var EntryCollection $value */ /* @var EntryInterface $entry */ /* @var FieldInterface $field */ /* @var RepeaterFieldType $type */