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

Use Drupal Form API #17

Open
4 tasks
jameswilson opened this issue Aug 13, 2018 · 0 comments
Open
4 tasks

Use Drupal Form API #17

jameswilson opened this issue Aug 13, 2018 · 0 comments

Comments

@jameswilson
Copy link

jameswilson commented Aug 13, 2018

All form (including end-user facing as well as the backend config forms) should be created using the Drupal 8 Form API whereby all of the functions in the Ebsco module file and templates that hardcode the building of <form> tags and their contents should instead be moved to PHP classes that extend FormBase implementing FormInterface; and specific sub-elements of the form that are not traditional form fields (such as the facet links) should implement their own custom templates. Note that while there is some overlap with #16, I've tried to group the tasks together in a way that makes sense for a proper refactor.

The reason to do this is so that form functionality can be altered using standard Drupal best practices of the hook_form_alter and templates would only be used to tweak form layout. It is exceedingly rare that a template or preprocess would be used to alter a form's functionality.

Non-exhaustive list of tasks required:

  • replace ebsco_basic_search_form with a Form class that can be altered with a hook_form_alter()
  • replace ebsco_advanced_search_form with a Form class that can be altered with a hook_form_alter()
  • replace ebsco_side_facets with a Form class that can be altered with a hook_form_alter() and a renderable arrays using custom Twig templates for the different filter displays.
  • replace ebsco_sort_form with a Form class that can be altered with a hook_form_alter()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant