Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- use DrupalCoreFormFormStateInterface;
- function MODULENAME_form_alter(&$form,$form_state, $form_id) {
- if ($form_id == 'FORMID') {
- $form['actions']['submit']['#validate'][] = 'MODULENAME_form_validate';
- }
- }
- function MODULENAME_form_validate($form, FormStateInterface $form_state) {
- $form_state->setValue('hidden_id', 'Value for Hidden field');
- }
- /**
- * Implements hook_ENTITY_TYPE_presave().
- */
- function webform_presave_webform_submission_presave(DrupalwebformEntityWebformSubmission $submission) {
- $submissionCreated = $submission->getCreatedTime();
- $submissionCreatedChnaged = format_date($submissionCreated, 'custom_date');
- $a = strptime($submissionCreatedChnaged, '%Y-%m-%d');
- $timestamp = mktime(0, 0, 0, $a['tm_mon']+1, $a['tm_mday'], $a['tm_year']+1900);
- $submission->setCreatedTime($timestamp);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement