Skip to content

Commit

Permalink
terminput.php
Browse files Browse the repository at this point in the history
  • Loading branch information
nilmerg committed Apr 27, 2023
1 parent 4438bd1 commit 5074af5
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions src/FormElement/TermInput.php
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,8 @@ public function onRegistered(Form $form)

$this->hasBeenAutoSubmitted = in_array($mainInputId, $autoSubmittedBy, true)
|| in_array($termContainerId, $autoSubmittedBy, true);

parent::onRegistered($form);
}

private function validateTerms(string $type, array $terms, array &$changes): bool
Expand Down Expand Up @@ -275,17 +277,12 @@ protected function assemble()
'data-data-input' => '#' . $dataInputId,
'data-term-input' => '#' . $termInputId,
'data-term-container' => '#' . $termContainerId,
'data-term-suggestions' => '#' . $suggestionsId,
'validators' => ['callback' => function ($value) use (&$mainInput) {
//$this->setValue($value);
$mainInput->getAttributes()
->registerAttributeCallback('value', function () {
return '';
});

return true;
}]
'data-term-suggestions' => '#' . $suggestionsId
]);
$mainInput->getAttributes()
->registerAttributeCallback('value', function () {
return null;
});
if ($this->getSuggestionUrl() !== null) {
$mainInput->getAttributes()->registerAttributeCallback('data-suggest-url', function () {
return (string) $this->getSuggestionUrl();
Expand Down

0 comments on commit 5074af5

Please sign in to comment.