[Drupal-8] How to handle multiple submission buttons in Drupal 8 form?

July 21, 2016 - 06:24

I had a requirement to handle multiple buttons in a custom form in Drupal 8. In Drupal 7 we can add multiple submissions using the button definition ['#submit'] => array('my_submit_function'). In drupal 8, same process is possible with slight changes as, ['#submit'] => array('::newSubmissionHandler') in button definition. Also we can get the form values to the custom submit handler as same as default handler. Just see the sample code below for more explanation. Note that the form should be saved in src/Form/MyForm.php.

[SOLVED] How to include third party libraries in Drupal 8 for custom modules?

May 09, 2016 - 07:42

In Drupal 8, third party libraries are downloaded and managed via composer. In each Drupal project there must be only one vendor folder. Composer Manager allows a single vendor/directory shared across all modules which prevent code duplication and version mismatches. This is done by merging the requirements of all modules found, into the consolidated composer.json file. In a custom module, set the dependency for composer manager module in .info file.