Share icon
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

Comments

Profile picture for user Jordan
Anees (not verified)
Sun, 07/11/2021 - 08:39
Awesome post found on google, I am new on drupal 8 module creation and that example helps me very good
Profile picture for user admin
admin
Wed, 08/23/2023 - 11:22

Thanks

Profile picture for user Jordan
betsy751869334… (not verified)
Sat, 11/13/2021 - 15:33
Hello, I do think your site may be having browser compatibility problems. Whenever I look at your site in Safari, it looks fine however, if opening in IE, it has some overlapping issues. I merely wanted to provide you with a quick heads up! Aside from that, wonderful blog!
Profile picture for user Jordan
cortneystanfill4473 (not verified)
Sat, 11/13/2021 - 15:43
Hi there, I check your blog like every week. Your writing style is witty, keep it up!
Profile picture for user Jordan
veronag040535061701 (not verified)
Tue, 12/14/2021 - 23:25
Thanks for the auspicious writeup. It in fact was a enjoyment account it. Look advanced to more introduced agreeable from you! However, how can we keep in touch?
Profile picture for user Jordan
finleyrausch95382245 (not verified)
Wed, 12/15/2021 - 00:04
Hi Dear, are you genuinely visiting this web page regularly, if so afterward you will without doubt get pleasant know-how.
Profile picture for user Jordan
bryantprimm6156785 (not verified)
Fri, 05/19/2023 - 03:04
I have been browsing online more than three hours lately, but I never discovered any attention-grabbing article like yours. It's lovely worth enough for me. In my view, if all webmasters and bloggers made excellent content material as you probably did, the net will probably be a lot more useful than ever before.

Add new comment

Restricted HTML