Drupal

Selectively disabling Bootstrap tooltips for form field elements

Submitted by Charles on Sun, 04/05/2020 - 13:45

On a Drupal 8, Bootstrap based site that I’m currently working on we have a couple of forms that have a boolean ‘Acknowledgement’ field that is displayed at the bottom.

Because we’ve enabled “Smart form descriptions (via Tooltips)” in the theme settings, the form field descriptions are not visible, but in this case we wanted to display it below the field, instead of as a tooltip.

Cache-Control: max-age header missing from static files in Drupal

Submitted by Charles on Sun, 07/24/2016 - 20:45

One of the sites I maintain recently had a server upgrade to Ubuntu 14.04.4, which included a new version of varnish (version 3.05) which required an update to the Varnish configuration. After setting up a new default.vcl file I was monitoring the headers sent and received to make sure that what was supposed to be cached was in fact being cached by Varnish. While testing I discovered that I was not getting any Cache-Control headers from static files like images.

CCK form field changes using Drupal's hook_form_alter don't work? Use #after_build

Submitted by Charles on Sun, 08/22/2010 - 15:17

I ran into issues when trying to use drupal's hook_form_alter to change some attributes of cck fields in a node form. It appears that depending on the weight of the module the form_alter is in, it might get called before the actual form element has been processed.

To make sure, you can set a function to be called after the form has been properly created, but before rendering.

In your form alter, add the after build key to the form field's array:

$form['field_course_status']['#after_build'][] = 'course_disable_status_field';