Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/Form/AbstractJsonFormsForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
use Drupal\Core\Form\FormStateInterface;
use Drupal\json_forms\Form\Util\FieldNameUtil;
use Drupal\json_forms\Form\Util\FormCallbackExecutor;
use Drupal\json_forms\Form\Util\FormCallbackRegistrator;
use Drupal\json_forms\Form\Util\FormValidationUtil;
use Drupal\json_forms\Form\Validation\FormValidationMapperInterface;
use Drupal\json_forms\Form\Validation\FormValidatorInterface;
Expand Down Expand Up @@ -122,6 +123,7 @@ protected function buildJsonFormsForm(

if ($formState->isRebuilding()) {
$formState->set('$hasCalcInitField', FALSE);
FormCallbackRegistrator::clearPreSchemaValidationCallbacks($formState);
}

$definition = DefinitionFactory::createDefinition($uiSchema, $jsonSchema);
Expand Down
4 changes: 4 additions & 0 deletions src/Form/Util/FormCallbackRegistrator.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ final class FormCallbackRegistrator {

public const PRE_SCHEMA_VALIDATION_CALLBACKS_PROPERTY_KEY = 'json_forms.pre_schema_validation_callbacks';

public static function clearPreSchemaValidationCallbacks(FormStateInterface $formState): void {
$formState->set(self::PRE_SCHEMA_VALIDATION_CALLBACKS_PROPERTY_KEY, []);
}

/**
* Registers a callback that is executed before JSON schema validation.
*
Expand Down