New answers tagged

-1

Issue was missing JS includes. The working set is: <script type="application/json" data-drupal-selector="drupal-settings-json">{"path":{"baseUrl":"\/","scriptPath":null,"pathPrefix":"","currentPath":"screenshots","currentPathIsAdmin":false,"isFront":false,"currentLanguage":"en"},"pluralDelimiter":"\u0003","google_analytics":{"trackOutbound":true,"...


0

You need to set the value: $options = [ "none" => " - Select - ", "1" => "First", "2" => "Second", "3" => "Third", ]; Pass the $options to #options: Example: $form['select_project'] = [ '#type' => 'select', '#title' => 'Select project', '#options' => [ "1" => 'First', "2" => 'Second', ...


0

you can also do this too: (function ($, Drupal, drupalSettings) { 'use strict'; Drupal.behaviors.someThing = { attach: function (context) { if (context === document) { console.log('called inside'); // Once <-- } console.log('called outside'); // can be manny manny <-- }, }; ...


0

Tip: look for other javascript errors happening on the page. If a JS error happens before the the assignment of drupalSettings, it will not be initiated.


2

Don't forget AllowOverride All if your Apache is defaulted to AllowOverride None. The missing directive was prohibiting rewriting from working [properly?] since I had, lastly, moved the rules to .htaccess (where they are in a default installation). Added it to the "main" <Directory> in my <VirtualHost> and all is well.


0

do you have access to the nginx configuration for this website? If so, you can add the following to the configuration and see what happens. It might set already to 1m: http { #... client_max_body_size 10m; #... }


0

Most likely , your FULL HTML content authoring text format settings are limiting the markup you can use, stripping out the script (that's default behavior). You can either: 1. Modify the settings for the text format to not restrict markup 2. Create a new text format, without any of the filter options enabled; then switch the format on the body field in ...


0

I solved this, just in case anybody else comes across it. Drupal uses a variable called $op == "Update", which is an attribute on the Submit . When you use preventDefault() this is removed from the Form Data. The solution is to add this to the sweetalert callback function when they confirm to delete or whatever your use case is. formE.off('...


0

I got this working: gotchas: 1. Had to load ajax_view.js, added this code snippet to theme file, check your view source to make sure ajax_view.js is loaded. use \Drupal\views\ViewExecutable; function customthemename_views_pre_render(ViewExecutable $view) { if (isset($view) && ($view->storage->id() == 'community_plan_update_news_feed')) { ...


1

99 % sure it is the way your js file is set. as the above should work. for a test please do this: (function ($, Drupal, drupalSettings) { 'use strict'; Drupal.behaviors.testStuff = { attach: function (context) { alert('yes i am attached'); console.log(drupalSettings); if (drupalSettings.example) { console.log(...


Top 50 recent answers are included