eZ\Bundle\EzPublishCoreBundle\Features\Context\FieldTypeContext::createField PHP Метод

createField() публичный Метод

Creates a fieldtype ans stores it for later use.
public createField ( string $fieldType, string $name = null, boolean $required = false )
$fieldType string Type of the field
$name string Name of the field, optional, if not specified $fieldType is used
$required boolean True if the is the field required, optional
    public function createField($fieldType, $name = null, $required = false)
    {
        $fieldPosition = $this->getActualFieldPosition();
        $name = $name == null ? $fieldType : $name;
        $fieldCreateStruct = $this->contentTypeService->newFieldDefinitionCreateStruct($name, $this->fieldTypeInternalIdentifier[$fieldType]);
        $fieldCreateStruct->names = array(self::DEFAULT_LANGUAGE => $name);
        $fieldCreateStruct->position = $fieldPosition;
        $fieldCreateStruct->isRequired = $required;
        $fieldCreateStruct->defaultValue = $this->defaultValues[$fieldType];
        $this->fieldConstructionObject['fieldType'] = $fieldCreateStruct;
        $this->fieldConstructionObject['objectState'] = self::FIELD_TYPE_CREATED;
    }