Blog

Mon, 01/30/2017 - 16:25 by Chris Burge
HTML5 form validation can be disabled on Webforms by using hook_form_alter() to add a 'novalidate' attribute to the form element.
Sat, 09/03/2016 - 15:17 by Chris Burge
On a recent build where I used Panels extensively, I needed to be able to restrict the types of content that end users could insert into specific regions. For example, users should only be able to insert Buttons and Quotes in the Second Sidebar region and Header Images in the Header region. The solution was to override template_preprocess_panels_add_content_modal().
Wed, 01/20/2016 - 18:49 by Chris Burge
Out of the box, Entity Reference Prepopulate doesn't work with forms rendered inside Panelizer modals. Using hook_entityreference_prepopulate_providers_info, we can extend Entity Reference Prepopulate to support Panelizer.
Sun, 08/02/2015 - 13:12 by Chris Burge

Often, Drupal themers will hard-code images into a theme's template files (e.g. a site logo). In the era of responsive images, we now have the Picture module to handle the complexity that comes with responsive images. A themer can print a responsive site logo; it will just take a little more code.

Fri, 07/31/2015 - 10:47 by Chris Burge

Sometimes it is necessary to remove one or more items from a Webform select list. For example, a client has a registration form for an event that will travel to a number of cities. After the event has passed for a particular city, the client desires the option to register for that city to be removed.

If the client simply removes the key|value pair for a city from the 'Options' list, then the key will remain stored in the database as the 'data' value for each submission in the 'webform_submitted_data' table; however, the value will be removed because the value is stored in the 'webform_component' table. As a result, when running reports or exporting data, only the key will be available (e.g. 'boston' but not 'Boston, MA').

The solution is to modify the Webform Select List component to allow for options to be 1) removed from the select list rendered for end users AND 2) maintained for data processing purposes.

Pages

Subscribe to Blog