Add $contentTypeField to $form with value $fieldValue

@param FieldTypeInterface $contentTypeField
@param FormInterface      $form
337117
protected function addFieldToForm(FieldTypeInterface $contentTypeField, FormInterface $form)
    {
        $fieldTypeConfiguration = $this->fieldTypesConfiguration[$contentTypeField->getType()];

        $fieldParameters = array_merge(
            array(
                'label' => $this->multiLanguagesChoiceManager->choose($contentTypeField->getLabels()),
                'mapped' => false,
                'group_id' => 'data',
                'sub_group_id' => 'data',
            ),
            $this->getFieldOptions($contentTypeField)
        );

        if (isset($fieldParameters['required']) && $fieldParameters['required'] === true) {
            $fieldParameters['constraints'] = new NotBlank();
        }
        $form->add(
            $contentTypeField->getFieldId(),
            $fieldTypeConfiguration['type'],
            $fieldParameters
        );
    }
767203
public function addFields(array $data, string $contentType = 'text/plain') {
        foreach ($data as $key => $value) {
            $this->addField($key, $value, $contentType);
        }
    }
344259
private function appendProperForm(FormInterface $form, Definition $definition)
    {
        $identifier = $definition->getIdentifier();
        if ($form->has($identifier)) {
            return;
        }

        $type = sprintf('ekyna_%s_characteristic', $definition->getType());
        $options = array();
        if ($definition->getType() == 'choice') {
            $options['identifier'] = $identifier;
        }

        $parentData = null;
        if (null !== $this->parentDatas && null !== $characteristic = $this->parentDatas->findCharacteristicByIdentifier($identifier)) {
            $parentData = $characteristic->display($definition);
        }

        $form->add($identifier, $type, array_merge(array(
            'property_path' => '[' . $identifier . ']',
            'label' => $definition->getTitle(),
            'parent_data' => $parentData,
        ), $options));
    }
652661
protected function createContentTypeForm(Request $request, $option, ContentTypeInterface $contentType)
    {
        $method = "POST";
        if ("PATCH" === $request->getMethod()) {
            $option["validation_groups"] = false;
            $method = "PATCH";
        }
        $option["method"] = $method;

        return $this->createForm('oo_content_type', $contentType, $option);
    }
275002
private function setPostedValues(Entity\Content $content, $formValues, $contentType)
    {
        // Ensure all fields have valid values
        $formValues = $this->setSuccessfulControlValues($formValues, $contentType['fields']);
        $formValues = Input::cleanPostedData($formValues);
        unset($formValues['contenttype']);

        $user = $this->users->getCurrentUser();
        if ($id = $content->getId()) {
            // Owner is set explicitly, is current user is allowed to do this?
            if (isset($formValues['ownerid']) && (int) $formValues['ownerid'] !== $content->getOwnerid()) {
                if (!$this->users->isAllowed("contenttype:{$contentType['slug']}:change-ownership:$id")) {
                    throw new AccessControlException('Changing ownership is not allowed.');
                }
                $content->setOwnerid($formValues['ownerid']);
            }
        } else {
            $content->setOwnerid($user['id']);
        }

        // Hack … remove soon
        $formValues += ['status' => 'draft'];
        // Make sure we have a proper status.
        if (!in_array($formValues['status'], ['published', 'timed', 'held', 'draft'])) {
            if ($status = $content->getStatus()) {
                $formValues['status'] = $status;
            } else {
                $formValues['status'] = 'draft';
            }
        }

        // Set the object values appropriately
        foreach ($formValues as $name => $value) {
            if ($name === 'relation' || $name === 'taxonomy') {
                continue;
            }
            $content->set($name, (empty($value) || $this->isEmptyArray($value)) ? null : $value);
        }
        foreach ($contentType['fields'] as $fieldName => $data) {
            if ($data['type'] !== 'slug' || !isset($formValues[$fieldName])) {
                continue;
            }
            if ($this->slugify !== null) {
                $snail = $this->slugify->slugify($formValues[$fieldName]);
            } else {
                // @deprecated Required for BC overrides
                $snail = Slugify::create()->slugify($formValues[$fieldName]);
            }
            $content->set($fieldName, $snail);
        }

        $this->setPostedRelations($content, $formValues);
        $this->setPostedTaxonomies($content, $formValues);
    }
506678
protected function addChildrenField($form)
    {
        $form->add(
            'children',
            CollectionType::class,
            [
                'entry_type'   => self::class,
                'required'     => false,
                'allow_add'    => true,
                'allow_delete' => true,
                'prototype'    => true,
                'by_reference' => false,
            ]
        );
    }
1143460
public function setFormFieldType($formFieldType)
    {
        if (!is_string($formFieldType) || $formFieldType === '') {
            throw new InvalidArgumentException('"Form field type" argument must be a string and must not empty.');
        }

        $this->formFieldType = $formFieldType;

        return $this;
    }
409832
public function render(FieldValueInterface $fieldValue)
    {
        $value = $fieldValue->getValue();
        $value = unserialize($value);

        if (empty($value['href'])) {
            return '';
        }

        $options = $this->getFieldOptions($fieldValue->getField());

        $width = '';
        $height = '';
        if (!empty($options['width'])) {
            $width = 'width="' . $options['width'] . '"';
        }
        if (!empty($options['height'])) {
            $height = 'height="' . $options['height'] . '"';
        }

        return '<iframe src="' . $value['href'] . '" ' . $width . ' ' . $height . '></iframe>';
    }
328800
private function getParsedFieldValue(Field $field, Content $content, $language, $imageFieldIdentifier, $options = [])
    {
        try {
            $this->logger->debug(sprintf(
                'Fetching field content for contentId %s, fieldId %s, fieldName %s',
                $content->id,
                $field->id,
                $field->fieldDefIdentifier
            ));

            $fieldType = $this->fieldDefIdentifiers[$field->fieldDefIdentifier];

            return $this->typeValue->$fieldType($field, $content, $language, $imageFieldIdentifier, $options);
        } catch (Exception $e) {
            $this->logger->warning(sprintf(
                'Unable to fetch field content for contentId %s, fieldId %s, fieldName %s (original exception: %s)',
                $content->id,
                $field->id,
                $field->fieldDefIdentifier,
                $e->getMessage()
            ));
        }
    }
852809
public function addCompatibleContentType($contentType)
    {
        if (!\in_array($contentType, $this->compatibleContentTypes, true)) {
            $this->compatibleContentTypes[] = $contentType;
        }
    }
1323817
public function getFieldValue(Content $content, $field, $language, $options = [])
    {
        $fieldObj = $content->getField($field, $language);

        if (null === $fieldObj) {
            $fieldObj = $content->getField($field);
        }

        $contentType = $this->contentTypeService->loadContentType($content->contentInfo->contentTypeId);
        $imageFieldIdentifier = $this->getImageFieldIdentifier($content->id, $language);

        $relatedContentId = $this->getRelation($content, $fieldObj->fieldDefIdentifier, $language);
        $mapping = $this->relationMapper->getMapping($contentType->identifier, $field);

        try {
            if ($relatedContentId && $mapping) {
                $relatedContent = $this->contentService->loadContent($relatedContentId);

                if ($relatedContent && $relatedContent->versionInfo->contentInfo->published) {
                    $relatedContentType = $this->contentTypeService->loadContentType($relatedContent->contentInfo->contentTypeId);

                    if ($relatedContentType->identifier != $mapping['content']) {
                        throw new InvalidRelationException(
                            sprintf(
                                "Invalid relation: field '%s:%s' (object: %s, field: %s) has improper relation to object '%s' (object: %s) but '%s:%s' expected.",
                                $contentType->identifier,
                                $field,
                                $content->id,
                                $fieldObj->id,
                                $relatedContentType->identifier,
                                $relatedContentId,
                                $mapping['content'],
                                $mapping['field']
                            )
                        );
                    }
                    $relatedField = $content->getField($mapping['field'], $language);
                    $value = $relatedField ? $this->getParsedFieldValue($relatedField, $relatedContent, $language, $imageFieldIdentifier, $options) : '';
                } else {
                    $value = '';
                }
            } else {
                $value = $fieldObj ? $this->getParsedFieldValue($fieldObj, $content, $language, $imageFieldIdentifier, $options) : '';
            }
        } catch (InvalidRelationException $exception) {
            $this->logger->warning($exception->getMessage());

            $value = '';
        }

        return $value;
    }
1277073
private function prepareFields(ApiContentType $contentType, $fields = null)
    {
        if ($fields !== null) {
            if (strpos($fields, ',') !== false) {
                return explode(',', $fields);
            }

            return array($fields);
        }

        $fields = array();
        $contentFields = $contentType->getFieldDefinitions();

        foreach ($contentFields as $field) {
            $fields[] = $field->identifier;
        }

        return $fields;
    }
1160383
protected function modifyRecordValue(Content $entity, $field, $value)
    {
        $recordId = $entity->getId();
        $contentTypeName = (string) $entity->getContenttype();
        $canModify = $this->users->isAllowed("contenttype:$contentTypeName:edit:$recordId");
        if (!$canModify) {
            $this->loggerFlash->error(Trans::__('general.access-denied.content-not-modified', ['%title%' => $entity->getTitle()]));

            return;
        }
        $entity->$field = Input::cleanPostedData($value);
        $entity->_modified = true;
    }
372834
public function mapToFormData(ValueObject $contentType, array $params = [])
    {
        $resolver = new OptionsResolver();
        $this->configureOptions($resolver);
        $params = $resolver->resolve($params);

        $data = new ContentCreateData(['contentType' => $contentType, 'mainLanguageCode' => $params['mainLanguageCode']]);
        $data->addLocationStruct($params['parentLocation']);
        foreach ($contentType->fieldDefinitions as $fieldDef) {
            $data->addFieldData(new FieldData([
                'fieldDefinition' => $fieldDef,
                'field' => new Field([
                    'fieldDefIdentifier' => $fieldDef->identifier,
                    'languageCode' => $params['mainLanguageCode'],
                ]),
                'value' => $fieldDef->defaultValue,
            ]));
        }

        return $data;
    }
1218027
public function action($contentTypeName, array $changeRequest)
    {
        foreach ($changeRequest as $recordId => $actionData) {
            if ($actionData === null) {
                continue;
            }

            $repo = $this->em->getRepository($contentTypeName);
            foreach ($actionData as $action => $fieldData) {
                if (!$entity = $repo->find($recordId)) {
                    continue;
                }
                $this->modifyContentTypeRecord($repo, $entity, $action, $fieldData);
            }
        }
    }
641029
public function addHeader($headerFieldNameOrLine, $fieldValue = null)
	{
		$this->getHeaders()->addTextHeader($headerFieldNameOrLine, $fieldValue);
		return $this;
	}
507263
public function deserializeFieldType(GenericDeserializationVisitor $visitor, $contentAttributeValue, array $type, Context $context)
    {
        $facade = $visitor->getCurrentObject();
        if ($facade instanceof ContentAttributeFacade && null !== $facade->type) {
            if (isset($this->fieldTypes[$facade->type]) &&
                isset($this->fieldTypes[$facade->type]['deserialize_type'])
            ) {
                if ($this->fieldTypes[$facade->type]['deserialize_type'] == 'array' && is_scalar($contentAttributeValue)) {
                    $contentAttributeValue = array($contentAttributeValue);
                }

                return $visitor->getNavigator()->accept($contentAttributeValue, array('name' => $this->fieldTypes[$facade->type]['deserialize_type'], 'params' => array()), $context);
            }
        }

        return null;
    }