2 declare(strict_types = 1);
308 array $prototypeConfiguration = [],
312 $this->typeDefinitions = $prototypeConfiguration[
'formElementsDefinition'] ?? [];
313 $this->validatorsDefinition = $prototypeConfiguration[
'validatorsDefinition'] ?? [];
314 $this->finishersDefinition = $prototypeConfiguration[
'finishersDefinition'] ?? [];
315 $this->conditionContextDefinition = $prototypeConfiguration[
'conditionContextDefinition'] ?? [];
325 if ($prototypeConfiguration !== []) {
338 if (!isset($this->typeDefinitions[$this->type])) {
339 throw new TypeDefinitionNotFoundException(sprintf(
'Type "%s" not found. Probably some configuration is missing.', $this->type), 1474905835);
354 public function setOptions(array $options,
bool $resetFinishers =
false)
356 if (isset($options[
'rendererClassName'])) {
359 if (isset($options[
'label'])) {
362 if (isset($options[
'renderingOptions'])) {
363 foreach ($options[
'renderingOptions'] as $key => $value) {
367 if (isset($options[
'finishers'])) {
368 if ($resetFinishers) {
369 $this->finishers = [];
371 foreach ($options[
'finishers'] as $finisherConfiguration) {
372 $this->
createFinisher($finisherConfiguration[
'identifier'], $finisherConfiguration[
'options'] ?? []);
376 if (isset($options[
'variants'])) {
377 foreach ($options[
'variants'] as $variantConfiguration) {
384 [
'rendererClassName',
'renderingOptions',
'finishers',
'formEditor',
'label',
'variants']
403 if (!isset($this->typeDefinitions[$typeName])) {
404 throw new TypeDefinitionNotFoundException(sprintf(
'Type "%s" not found. Probably some configuration is missing.', $typeName), 1474905953);
407 $typeDefinition = $this->typeDefinitions[$typeName];
409 if (!isset($typeDefinition[
'implementationClassName'])) {
410 throw new TypeDefinitionNotFoundException(sprintf(
'The "implementationClassName" was not set in type definition "%s".', $typeName), 1477083126);
412 $implementationClassName = $typeDefinition[
'implementationClassName'];
413 $page = $this->objectManager->get($implementationClassName,
$identifier, $typeName);
415 if (isset($typeDefinition[
'label'])) {
416 $page->setLabel($typeDefinition[
'label']);
419 if (isset($typeDefinition[
'renderingOptions'])) {
420 foreach ($typeDefinition[
'renderingOptions'] as $key => $value) {
421 $page->setRenderingOption($key, $value);
427 [
'implementationClassName',
'label',
'renderingOptions',
'formEditor']
466 return isset($this->renderables[
$index]);
481 throw new FormException(sprintf(
'There is no page with an index of %d',
$index), 1329233627);
483 return $this->renderables[
$index];
493 $this->finishers[] = $finisher;
504 if (isset($this->finishersDefinition[$finisherIdentifier]) && is_array($this->finishersDefinition[$finisherIdentifier]) && isset($this->finishersDefinition[$finisherIdentifier][
'implementationClassName'])) {
505 $implementationClassName = $this->finishersDefinition[$finisherIdentifier][
'implementationClassName'];
506 $defaultOptions = $this->finishersDefinition[$finisherIdentifier][
'options'] ?? [];
509 $finisher = $this->objectManager->get($implementationClassName, $finisherIdentifier);
510 $finisher->setOptions($defaultOptions);
514 throw new FinisherPresetNotFoundException(
'The finisher preset identified by "' . $finisherIdentifier .
'" could not be found, or the implementationClassName was not specified.', 1328709784);
537 if (isset($this->elementsByIdentifier[$renderable->
getIdentifier()])) {
540 $this->elementsByIdentifier[$renderable->
getIdentifier()] = $renderable;
552 if ($renderable instanceof FormElementInterface) {
553 unset($this->elementsByIdentifier[$renderable->getIdentifier()]);
567 return $this->elementsByIdentifier[$elementIdentifier] ??
null;
580 $this->elementDefaultValues,
642 return $this->objectManager->get(FormRuntime::class, $this, $request, $response);
651 if (!isset($this->processingRules[$propertyPath])) {
652 $this->processingRules[$propertyPath] = $this->objectManager->get(ProcessingRule::class);
654 return $this->processingRules[$propertyPath];