Wasn't sure exactly what to search for in trying to find recommendations for this.
I have created a custom content entity type with some numerical fields. The canonical view for this entity uses
"views_data" = "Drupal\views\EntityViewsData" as specified in the entity definition annotation. This entity type does not depend on
node. Some modifications are made to the display of the field data using hook_entity_view_alter and hook_page_attachments. This is all working fine.
What I would like to do is two things:
1) add an additional HTML section to the canonical view, below the display of all the entity parameters, which displays the results of a database query. The query being executed will depend on the content of the entity being loaded. Currently I am just using "echo" to test, but that spits the results out at the top of the document.
2) add a form to the canonical view containing one text field, one dropdown, and one button. The contents of the dropdown will also depend on the entity field content. The button should perform some calculations on the numerical fields based on the form inputs, and adjust the build array contents accordingly after reloading the page.
I am not really sure what approach to take here or how to execute it, and would like to ask for recommendations and examples to look at. Should I be creating a custom class that extends
Drupal\views\EntityViewsData to accomplish all of this? Should I be doing this with Twig instead (which I am not very familiar with and can't seem to find many examples similar to what I'm trying to do)? Would using jQuery instead be a better approach?