Skip to content

Use Drupal Form API #17

@jameswilson

Description

@jameswilson

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()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions