logo

Drupl8 custom form

22 Apr 2020

Set current date in custom form element in DRUPAL8

Published On: Wed, 04/22/2020 - 22:13

Set current date in custom form element in DRUPAL8

Add this line at top

 use Drupal\Core\Datetime\DrupalDateTime; 

Add the following code to your form

function HOOK_form_alter(…