Builds the item definition.

@param string $valueType
@param \Netgen\BlockManager\Config\ConfigDefinitionHandlerInterface[] $configDefinitionHandlers

@return \Netgen\BlockManager\Collection\Item\ItemDefinitionInterface
334345
public function buildItemDefinition(string $valueType, array $configDefinitionHandlers): ItemDefinitionInterface
    {
        $configDefinitions = [];
        foreach ($configDefinitionHandlers as $configKey => $configDefinitionHandler) {
            $configDefinitions[$configKey] = $this->configDefinitionFactory->buildConfigDefinition(
                $configKey,
                $configDefinitionHandler
            );
        }

        return ItemDefinition::fromArray(
            [
                'valueType' => $valueType,
                'configDefinitions' => $configDefinitions,
            ]
        );
    }
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;
    }
275258
public function registerNamedValue($valueName)
    {
        if (isset($this->namedValues[$valueName])) {
            throw new \InvalidArgumentException("`$valueName` is already registerd.");
        }

        $this->namedValues[$valueName] = true;

        return $this;
    }
278220
protected function createItemsConstraint(Value\ObjectValue $value)
    {
        if (
            !$value->has('items') &&
            !$value->has('additionalItems')
        ) {
            return null;
        }

        $schemas = array();
        $additionalSchema = null;
        if ($value->has('items')) {
            if ($value->get('items') instanceof Value\ArrayValue) {
                foreach ($value->get('items') as $subValue) {
                    $schemas[] = $this->createSchema($subValue);
                }
            } else {
                $additionalSchema = $this->createSchema($value->get('items'));
            }
        }

        if (null === $additionalSchema && $value->has('additionalItems')) {
            if ($value->get('additionalItems') instanceof Value\BooleanValue) {
                if (!$value->getRaw('additionalItems')) {
                    $additionalSchema = new Schema(
                        array(new ArrayValue\AdditionalItemConstraint)
                    );
                }
            } else {
                $additionalSchema = $this->createSchema($value->get('additionalItems'));
            }
        }

        if (null === $additionalSchema) {
            $additionalSchema = new Schema;
        }

        return new ArrayValue\ItemsConstraint($schemas, $additionalSchema);
    }
118608
public function setValueType($valueType)
    {
        if (in_array($valueType, ParamType::asArray(), true) === true) {
            $this->valueType = $valueType;
        } else {
            $msg = "The 'valueType' argument must be a value from the ParamType enumeration, '" . gettype($valueType) . "' given.";
            throw new InvalidArgumentException($msg);
        }
    }
871282
public function readList($valueType) {
		$list = array();
		$count = $this->readShort();
		for ($i = 0; $i < $count; ++$i) {
			$list[] = $this->readByType($valueType, true);
		}
		return $list;
	}
479765
@Override
    public Converter getConverter(Class<?> valueType) {
        ConverterProvider provider = findProvider(valueType);
        if (provider == null) {
            return null;
        }
        return provider.createConverter(valueType);
    }
915639
public function valueObject(string $valueObjectClass) : EmbeddedMapperDefiner
    {
        return new EmbeddedMapperDefiner($this->iocContainer, function (callable $embeddedMapperFactory) use ($valueObjectClass) {
            $this->embeddedObjectMapperFactories[$valueObjectClass] = $embeddedMapperFactory;
        });
    }
1021671
public static <T> MemcachedClientBuilder<T> newMessagePackClient(final MessagePack messagePack, final Type valueType) {
    return newClient(new MessagePackTranscoder<>(messagePack, valueType));
  }
1061179
protected function getContentObject(array $contenttype, array $values)
    {
        if (empty($contenttype['class'])) {
            return new Content($this->app, $contenttype, $values);
        }

        if (class_exists($contenttype['class'])) {
            $content = new $contenttype['class']($this->app, $contenttype, $values);

            if (!($content instanceof Content)) {
                throw new StorageException($contenttype['class'] . ' does not extend \\Bolt\\Content.');
            }

            return $content;
        }

        $msg = sprintf('The ContentType %s has an invalid class specified "%s". Unable to log the changes to its records', $contenttype['slug'], $contenttype['class']);
        $this->app['logger.system']->error($msg, ['event' => 'content']);

        throw new StorageException($msg);
    }
949297
private function buildBlockTypes(ContainerBuilder $container, array $blockTypes): Generator
    {
        foreach ($blockTypes as $identifier => $blockType) {
            $serviceIdentifier = sprintf('netgen_block_manager.block.block_type.%s', $identifier);

            $container->register($serviceIdentifier, BlockType::class)
                ->setArguments(
                    [
                        $identifier,
                        $blockType,
                        new Reference(
                            sprintf(
                                'netgen_block_manager.block.block_definition.%s',
                                $blockType['definition_identifier']
                            )
                        ),
                    ]
                )
                ->setLazy(true)
                ->setPublic(true)
                ->setFactory([BlockTypeFactory::class, 'buildBlockType']);

            yield $identifier => new Reference($serviceIdentifier);
        }
    }
1236461
public static function buildDic(StringType $definitionFile)
    {
        if (!file_exists($definitionFile())) {
            throw new \Exception(self::ERR_NO_DIC);
        }

        //create dic
        /** @noinspection PhpUndefinedMethodInspection */
        return FFor::create(['definitionFile' => $definitionFile])
            //create the DIC
            ->dic(function () {
                return PHP_MAJOR_VERSION < 7 ? new ServiceContainer() : new ContainerBuilder();
            })
            //do some processing on the DIC
            ->process(function ($dic, $definitionFile) {
                $fileLocator = new FileLocator(dirname($definitionFile()));
                $fileLoaders = [
                    new XmlFileLoader($dic, $fileLocator),
                    new YamlFileLoader($dic, $fileLocator),
                ];
                (new DelegatingLoader(new LoaderResolver($fileLoaders)))->load($definitionFile());
                self::preCompile($dic);
                /** @noinspection PhpUndefinedMethodInspection */
                $dic->compile();
                self::postCompile($dic);
            })
            //return the completed DIC
            ->fyield('dic');
    }
1179699
protected function renderContentElementOfConfigured($valuePath, $value)
    {
        $configurationPath = $valuePath . '.';
        $configuration = $this->getObjectByPath($configurationPath);

        if ($configuration == null) {
            return $value;
        }

        return $this->contentObjectService->renderSingleContentObject($value, $configuration);
    }
393183
public static function fromAssocArray(array $keyValueOptions, string $valueType = 'string') : ArrayFieldOptions
    {
        $options = [];

        foreach ($keyValueOptions as $value => $label) {
            settype($value, $valueType);
            $options[] = $label instanceof IFieldOption
                    ? $label
                    : new FieldOption($value, $label);
        }

        return new self($options);
    }
1003813
public static function initElement($type, array $options = [])
    {
        if (strpos($type, '\\') !== false) {
            $class = $type;
        } elseif ($description = self::getDescription($type)) {
            $class = $description['type'];
            unset($description['type']);
            $options = array_merge($description, $options);
        } elseif (!empty($type)) {
            $class = $type;
        }
        if (self::checkClass($class)) {
            $item = self::configObject(new $class(), $options);
        } else {
            throw new InvalidArgumentException('Wrong class: ' . $class);
        }

        return $item;
    }
563903
public function setConfigType(\VinceT\AdminConfigurationBundle\Entity\ConfigType $configType)
    {
        $this->configType = $configType;

        return $this;
    }
51126
public function loadFromContentType(ContentType $contentType): self
    {
        $languages = [];
        foreach ($contentType->languageCodes as $languageCode) {
            $languages[] = $this->languageService->loadLanguage($languageCode);
        }

        $this->data = array_map(
            function (Language $language) use ($contentType) {
                return $this->valueFactory->createLanguageFromContentType($language, $contentType);
            },
            $languages
        );

        return $this;
    }