Field example



        $form = $this->getRepository()->find($id);
        if (!$form instanceof Form) {
            $this->View()->assign(['success' => false, 'message' => 'Form not found']);

            return;
        }

        $params = $this->Request()->getParams();

        $fieldModel = new Field();
        $fieldModel->fromArray($params);
        $fieldModel->setForm($form);

        $this->getManager()->persist($fieldModel);
        $this->getManager()->flush();

        $data = $this->getManager()->toArray($fieldModel);
        $this->View()->assign(['success' => true, 'data' => $data]);
    }

    public function removeFieldAction()
    {
'helpText' => '',
            'defaultValue' => '',
            'displayField' => '',
            'valueField' => '',
            'allowBlank' => false,
            'translatable' => false,
            'position' => $this->getMaxPositionValue(),
        ];

        $this->maxFieldPositionValue = max($data['position']$this->maxFieldPositionValue) + 1;

        $field = new Field();
        $field->fromArray($data);

        $field->setComponent($this);
        $this->fields->add($field);

        return $field;
    }

    /** * Creates a checkbox field for the passed emotion component widget. * * Creates a Ext.form.field.Checkbox element. * http://docs.sencha.com/extjs/4.2.2/#!/api/Ext.form.field.Checkbox * * options { * string $name Required; Logical name of the component field * string $fieldLabel optional; Ext JS form field label * string $allowBlank Optional; Defines if the value can contain null * } * * @param array{name: string, fieldLabel?: string, allowBlank?: bool} $options * * @return Field */
foreach ($fieldset['fields'] as $field) {
            $fields[] = $this->createField($field);
        }

        $class->setFields($fields);

        return $class;
    }

    public function createField(array $field): Field
    {
        $class = new Field();
        $class->setName($field['name']);
        $class->setLabel($field['label']);
        $class->setTypeName($field['type']);
        $className = $this->getClassByAlias($field['type']) ?: $field['type'];

        if (!\is_string($className) || !class_exists($className) || !$this->implementsFieldInterface($className)) {
            $className = DummyField::class;
        }

        $class->setType(new $className());

        
Home | Imprint | This part of the site doesn't use cookies.