New answers tagged

0

I recommend looking into the Decoupled Pages module which can make integrating Vue.js simpler.


1

Run the check on page page load, not just on click: ... wrapped in the usual Drupal boilerplate disableFilter($('#edit-field-agegroup-value-1')); $('#edit-field-agegroup-value-1').click(function() { disableFilter($(this)); }); function disableFilter(element) { if( element.is(':checked')) { $("#edit-field-classroom-value-3").prop('...


1

The documentation is inevitably focused on PHP, since Drupal is written in PHP and server-side renders. And the answer to getting info from PHP/server side to JS/client side is not really Drupal specific. Like any other situation of this ilk in web development, you have two basic choices. Either annotate your HTML with enough elements, IDs and classes ...


4

The answer lies here: $('#portfolioModal', context).once('bootstrap-modal-shown', console.log('*** REGISTER SHOWN.BS.MODAL')) The code that comes after the call to $.once() will only be executed once. However, $.once() can and will be executed multiple times. That's why you are seeing your calls to the console being called multiple times. If you change ...


0

I solved, mostly by implementing the theme_process_html_tag method in the template. Note the PROCESS not PREprocess. In my case, the theme was extending the 'zen' theme, which was actually removing all 'type' attributes from scripts in the header (I don't know exactly why). But I was able to overwrite this behavior in the theme hook mentioned above.


0

This doesn't answer the original question, but turns out to be a better solution in my case. You must clear your cache with each change to this function: /** * Implements hook_library_info_alter(). */ function example_library_info_alter(&$libraries, $extension) { // If you have 'stack' as your subtheme, you might have unwanted lightbox assets. ...


0

You could try the FileField Sources module. It provides quite a few additional options to upload files. Re-use files by an auto-complete textfield Attach server-side files uploaded via FTP Transfer files from a remote server (cURL required) Paste a file directly from the clipboard (Drupal 7 only) Select existing files through the IMCE file ...


5

Behaviors will be executed on every request, including AJAX requests. you can use the once function to make sure it is only triggered once. (function ($, Drupal) { Drupal.behaviors.mei_library_turn = { attach: function(context, settings) { $('main', context).once('mei_library_turn').each(function () { console.log('ready1'); }...


0

I fixed it for fieldset adding an #id attribute and set #states in hook_field_group_build_pre_render_alter. /** * Implements hook_field_group_build_pre_render_alter(). */ function MY_MODULE_field_group_build_pre_render_alter(&$element) { if ($element['#form_id'] === 'MY_FORM' && isset($element['MY_FIELDSET_NAME'])) { // Add form states ...


Top 50 recent answers are included