New answers tagged

0

Have your POST code inside a validate function, that runs last, after all other validation has passed. Ex: $form['submit']['#validate'][] = 'mymodule_post_to_api'; and use form_set_error('form', 'Failed to connect to API, try again later'); inside your catch. For POST's errors, don't wait for someone to report. Programmatically make Drupal send yourself ...


0

I found a good solution. Since there were multiple elements that depended on the same condition for visibility, I realized I could put them into a fieldset and define the condition for the fieldset instead. This did the trick.


0

The UUID for all your CSV records is 1 and when they are being imported, each row is overwriting the previous row. You also need to include the column headers as the first row in the CSV.


0

I made the label for the wizard page non-breaking-space  . It is ugly but it works. Luckily we didn't need the page headings.


3

This should be as easy as changing the wizard page's display settings, but you found a bug. Issue #3106037: Allow a multi-step wizard page's display to be customized Once you apply the patch, in the page element's 'Advanced' you can change how the page is displayed via HTML and text. You can use Twig to just render the child element.


0

I figgured out. It was because the theme template rewrite the form input element and this broke automatic comuting on forms.


2

It looks like the issue lies with the SMTP module. The release notes for 8.x-1.0-beta6 include a bug fix for: #2993124 by jmuzz, qichanghai, Chris Matthews: Call to Undefined Method error _get_components when there is a BCC


0

Just install devel php run your code and then uninstall it. https://www.drupal.org/project/devel_php As it is great for quick adhock tasks. but yep keep back up of your database ect.


2

We can look at Drupal\node\NodeTypeForm.php for an example. We see the name and type fields defined like: $form['name'] = array( '#title' => t('Name'), '#type' => 'textfield', // ... ); $form['type'] = array( '#type' => 'machine_name', // ... '#machine_name' => array( 'exists' => [ 'Drupal\node\Entity\NodeType', '...


0

You can use the fields defined on the graphql_json module in order to retrieve the webform structure. { webformById(webform_id: "contact") { webform { elements { name: path(steps: "#name") { ... on JsonLeaf { value } } type: path(steps: "#type") { ... on JsonLeaf { ...


0

To load webform submissions of a particular webform programmatically - $webform = \Drupal\webform\Entity\Webform::load('WEBFORM_ID'); //webform id is the webform name if ($webform->hasSubmissions()) { $query = \Drupal::entityQuery('webform_submission') ->condition('webform_id', 'WEBFORM_ID'); $result = $query->execute()...


0

file_load() has been deprecated Instead, in a custom module you can use the function Drupal\file\Entity\file::load($fid) to load a file with the file ID that is present in the webform submission values Here is an example : use Drupal\file\Entity; function student_support_form_submit(&$form, \Drupal\Core\Form\FormStateInterface $form_state){ ...


Top 50 recent answers are included