R
R
Roman2019-04-25 17:15:09
Drupal
Roman, 2019-04-25 17:15:09

Drupal 8, how to connect custom form and JS on one page?

First, I needed to connect my form in my plugin.
Implemented:
registered in routing

_form: '\Drupal\my plugin\Form\my form'

After that, it was required to connect JS on this page
. But, as I understand it, in routing you need to write either
_form:

or
_controller:

How to eat a fish and not sit down?)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
afi13, 2019-04-25
@gagablik

You need to declare your js file in *.libraries.yml file of your module and then add JS to the form
For more details, see the documentation
https://www.drupal.org/docs/8/creating-custom-modu...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question