New answers tagged

3

Webforms are configuration entities and they need to be translated using a different UI/UX. @see https://www.youtube.com/watch?v=dfG37uW5Qu8


0

I have a work-around, but not a solution: Go to /admin/structure/webform/config/elements In the section "Element Formats" change "Date/Time" from "- default -" to "Default medium date (medium)"


1

Drupal in D8 added UUID to identify & differentiate one Drupal from another and was also added so people don't accidentally add config to the wrong site. So you already got an export from site A. Now on site B do an export for an existing webform, like Contact (which was created by default when you installed webform) and copy its UUID value. Now use ...


5

You can alter a webform by modifying the YAML content of the config field elements: use Drupal\webform\Entity\Webform; use Drupal\Core\Serialization\Yaml; $webform = Webform::load('contact'); $elements = Yaml::decode($webform->get('elements')); // add a field $elements['additional_field'] = [ '#type' => 'textfield', '#title' => '...


2

This is a gotcha of AJAX forms. When you load an AJAX form via AJAX it loses its AJAX functionality. In order to keep it working you need to add a url and options keys to #ajax /* * Implements hook_form_alter() */ function mymodule_form_alter(&$form, FormStateInterface $form_state, $form_id) { // I created a webform called "test" if ($...


1

I believe I may have found the answer in WebformEntityTest.php in the Webform module. There, a test creates a webform with the following settings for the scheduled dates... $webform->setStatus(WebformInterface::STATUS_SCHEDULED); // Check set open date to yesterday. $webform->set('open', date('Y-m-d\TH:i:s', strtotime('today -1 days'))); $webform->...


1

As you can see in line 264 of webform.submissions.inc Webform uses submission as the key. Thus it needs to be named mimemail-message--webform--submission.tpl.php There is no way to target a specific webform without some extra custom code work. mymodule.module function mymodule_mail_alter(&$message) { if ($message['module'] == 'webform') { $nid = $...


1

Drupal 8 Webform can be opened in modal dialogs using links with the .webform-dialog class a. Common settings Configuration ยป Forms: /admin/structure/webform/config 1. FORM DIALOG SETTINGS - Dialog options: set option Enable site-wide dialog support. Do patch for load script by preg_match 2. Check Form URL path settings b. On webform settings ...


0

This is a solution for my scenario and post it if can help anyone. So, my "custom composite" element is multivalue and for print it in my custom entity-print--webform-submission--test.html.twig file I have insert this code: {% for item in data.my_custom_composite %} <tr> <td>{{ item.day|date('d.m.Y') }}</...


2

What is the purpose of that redirect() method if it doesn't redirect? You find this method in both, controller and form: ControllerBase::redirect() FormBase::redirect() It creates a redirect response and you return it if a certain condition is met: if (...) { return $this->redirect($route_name); } Example: https://drupal.stackexchange.com/a/277596/...


0

I scanned Webform's code base for [webform_submission:values: and eventually found the webform.token.inc file to list a number of Webform tokens from submission values. One of them being entity:*. And another being delta. '<li>element_key:entity:*</li>' . '<li>element_key:delta:entity:*</li>' The 'entity:*' applies to the referenced ...


1

Personally, I would create a multi step/page webform or multi step/page custom form instead of having two separate forms, but to answer your question: In your webform settings: In your custom form code public function buildForm(array $form, FormStateInterface $form_state) { // redirect if (!\Drupal::request()->query->get('hello') == 'world') ...


Top 50 recent answers are included