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

Add radios field and checkboxes field #57

Merged
merged 1 commit into from
Sep 24, 2024
Merged

Add radios field and checkboxes field #57

merged 1 commit into from
Sep 24, 2024

Conversation

dontub
Copy link
Contributor

@dontub dontub commented Sep 20, 2024

systopia-reference: 26357

@dontub dontub requested a review from jensschuppe September 20, 2024 08:22
Copy link
Contributor

@jensschuppe jensschuppe left a comment

Choose a reason for hiding this comment

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

Not sure what types of fields this supports …

  • Single Checkbox
  • Single Radio Button
  • multiple Checkboxes
  • multiple Radio Buttons
  • single-option Select Field
  • multi-value Select Field

@dontub
Copy link
Contributor Author

dontub commented Sep 23, 2024

Not sure what types of fields this supports …

* Single Checkbox

* Single Radio Button

* multiple Checkboxes

* multiple Radio Buttons

* single-option Select Field

* multi-value Select Field
  • \Civi\RemoteTools\Form\FormSpec\Field\RadioField: Single radio button. Shall I rename it to RadioButton?
  • \Civi\RemoteTools\Form\FormSpec\Field\CheckboxesField: Multiple Checkboxes.

@jensschuppe
Copy link
Contributor

Drupal calls them Radio, Radios, Checkbox, Checkboxes, and Select (the latter with #multiple attribute for Multi-Value Select) - corresponding to HTML element names, which are input types radio, checkbox and the select field type. CiviRemote seems to be consistently adding Field to the class name, so the naming is ok. I was just wondering why the other field types weren't covered.

@dontub
Copy link
Contributor Author

dontub commented Sep 24, 2024

\Civi\RemoteTools\Form\FormSpec\Field\CheckboxField and \Civi\RemoteTools\Form\FormSpec\Field\SelectField already exist.

In JSON Forms there are only checkboxes for multiple selects specified: https://jsonforms.io/docs/multiple-choice#multi-select

It would be possible to use a custom option like for the [https://jsonforms.io/docs/multiple-choice#radio-button](single radio) to use a select field for multi selects. Yes, I think it would make sense to implement this. However, for the current use case it's not necessary.

Regarding \Civi\RemoteTools\Form\FormSpec\Field\RadioField I've to correct myself: It is meant to define a single value for a single property via a group of radio buttons. So I think it would be reasonable to rename it to RadiosField. A single radio button makes no sense, anyway (and is also in Drupal only internal).

@dontub dontub requested a review from jensschuppe September 24, 2024 10:13
@dontub dontub changed the title Add radio field and checkboxes field Add radios field and checkboxes field Sep 24, 2024
@dontub dontub merged commit d4ffaac into master Sep 24, 2024
9 checks passed
@dontub dontub deleted the add-field-types branch September 24, 2024 12:24
@dontub dontub added enhancement New feature or request status:fixed The issue has been resolved (usually by committing/merging code). labels Sep 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request status:fixed The issue has been resolved (usually by committing/merging code).
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants