Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FormElement: Add Multiselect element #65

Closed
wants to merge 10 commits into from

Conversation

sukhwinder33445
Copy link
Contributor

No description provided.

@cla-bot cla-bot bot added the cla/signed label Jul 13, 2022
@sukhwinder33445 sukhwinder33445 force-pushed the add-multiselect-element branch 3 times, most recently from 5fb3558 to c51f7cb Compare July 15, 2022 07:58
@sukhwinder33445 sukhwinder33445 requested a review from nilmerg July 15, 2022 07:58
@lippserd lippserd self-requested a review July 15, 2022 08:00
@sukhwinder33445 sukhwinder33445 force-pushed the add-multiselect-element branch 2 times, most recently from 23e1f3b to ca695ed Compare July 15, 2022 08:48
@sukhwinder33445 sukhwinder33445 self-assigned this Jul 15, 2022
@sukhwinder33445 sukhwinder33445 added the enhancement New feature or request label Jul 15, 2022
@sukhwinder33445 sukhwinder33445 force-pushed the add-multiselect-element branch 3 times, most recently from 7dd0883 to 41d50de Compare July 15, 2022 09:31
src/FormElement/MultiSelectElement.php Outdated Show resolved Hide resolved
src/FormElement/MultiSelectElement.php Outdated Show resolved Hide resolved
src/FormElement/SelectElement.php Outdated Show resolved Hide resolved
src/FormElement/MultiSelectElement.php Outdated Show resolved Hide resolved
src/FormElement/MultiSelectElement.php Outdated Show resolved Hide resolved
tests/FormElement/MultiSelectElementTest.php Outdated Show resolved Hide resolved
tests/FormElement/MultiSelectElementTest.php Outdated Show resolved Hide resolved
tests/FormElement/MultiSelectElementTest.php Outdated Show resolved Hide resolved
@sukhwinder33445 sukhwinder33445 requested a review from nilmerg July 28, 2022 08:23
src/FormElement/MultiSelectElement.php Outdated Show resolved Hide resolved
src/FormElement/MultiSelectElement.php Outdated Show resolved Hide resolved
src/FormElement/SelectElement.php Outdated Show resolved Hide resolved
@sukhwinder33445 sukhwinder33445 force-pushed the add-multiselect-element branch 5 times, most recently from 1d04828 to 2e45745 Compare July 28, 2022 14:03
@sukhwinder33445 sukhwinder33445 requested a review from nilmerg July 28, 2022 14:03
src/FormElement/SelectElement.php Outdated Show resolved Hide resolved
src/FormElement/SelectElement.php Outdated Show resolved Hide resolved
@sukhwinder33445 sukhwinder33445 force-pushed the add-multiselect-element branch 3 times, most recently from d520fbf to cc22abe Compare July 29, 2022 09:14
@sukhwinder33445 sukhwinder33445 requested a review from nilmerg July 29, 2022 09:14
@sukhwinder33445 sukhwinder33445 force-pushed the add-multiselect-element branch from 04340e1 to b21a796 Compare August 1, 2022 16:14
nilmerg
nilmerg previously approved these changes Aug 2, 2022
@nilmerg nilmerg added this to the v0.7.0 milestone Aug 2, 2022
@sukhwinder33445 sukhwinder33445 force-pushed the add-multiselect-element branch from 134831c to 6165b61 Compare October 10, 2022 09:13
@sukhwinder33445 sukhwinder33445 changed the title FormElement: Add MultiSelect element FormElement: Add Multiselect element Oct 10, 2022
@sukhwinder33445 sukhwinder33445 force-pushed the add-multiselect-element branch from 6165b61 to b3ae3d7 Compare October 27, 2022 09:22
nilmerg
nilmerg previously approved these changes Nov 7, 2022
Copy link
Member

@lippserd lippserd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use nowdoc for expected HTML.

src/FormElement/MultiselectElement.php Outdated Show resolved Hide resolved
src/FormElement/MultiselectElement.php Outdated Show resolved Hide resolved
}
}

BaseFormElement::validate();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not parent?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because the parent class checks its own value first, since I already have a loop above for this check, I skip calling the parent method.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exactly. In addition we have duplicated code. This shows that the code flow is flawed, and it raises the question of why we even have a separate element for this. Instead, specifying the multiple attribute for the select element should just work.

$this->valid = false;
} else {
parent::validate();
$this->addMessage(sprintf($this->translate("'%s' is not allowed here"), $value));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Possible candidate for InArrayValidator or DeferredInArrayValidator.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have already created a new PR for this.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But I don't see its usage here.

}
}

BaseFormElement::validate();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exactly. In addition we have duplicated code. This shows that the code flow is flawed, and it raises the question of why we even have a separate element for this. Instead, specifying the multiple attribute for the select element should just work.

@sukhwinder33445
Copy link
Contributor Author

Add multiple attribute functionality to SelectElement.

@nilmerg nilmerg removed this from the v0.7.0 milestone Nov 8, 2022
@nilmerg nilmerg removed the enhancement New feature or request label Nov 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants