custom form with menulink drupal 8

Hi guys, In this article we see how we can make custom form with a menu link in drupal 8. Some of criteria of creating is changed form drupal 7 but it is quiet to understand the new setup, so let's start

For this we need to create a custom module so create a folder and make info.yml file 

1) Create modulename.info.yml file

2) Create routing.yml file for menu link and define the form page

3) Create the src/form folder and under it create "CustomForm.php" that we define under our routing file.

Now Enable the module from UI and go to http;//yourwebsite/my-menu-form and you will see the form after submit all process form elements will display under drupal_set_message

you can use them for your purpose.

Hope this articles helps.

GITHUB URLhttps://github.com/key2goal/module-with-a-form-and-menu-link

Add new comment

Restricted HTML