Use TypeKit in a Drupal 7 Theme

One of the new themes we rigged up for a client requires the use of TypeKit. The easiest way I found to add the JS they provide is to just add it to the template.php file in hook_preprocess_page. The function drupal_add_js() will allow for external js files, as well as inline scripts. Use the code below, and if external js caching is turned on, it should pick that up while still providing the dynamic fire call you need. Just make sure you update the third parameter on the second function to be some region in your theme. The drupal semi default 'page_bottom' is a pretty safe call.

Tags: 

Alter views display options at the theme level

My client today need the mobile version of the retailer locator to shrink down and fit the new mobile theme. Going from about 700px wide to 300ish, with a height change as well. The cleanest route I found for doing this is to have the theme itself alter the view just before rendering. Here's the code, pretty simple once you get past all the dominating recursion.

Tags: 

Creating date popup fields using Drupal form api

Note that the date module is required for this form element type.
An additional guide to using these elements is available on drupal.org.
For a full list of options available, you'll need to check the module code itself at: date/date_api/date_api_elements.inc::_date_api_element_info()

Tags: 

Setting CCK and Location Default Values

Had a bit of trouble setting default values for a location item today. It seems I was outsmarting myself, or maybe location was smarter than I gave it credit for. I couldn't seem to use form_alter() to set default values for the location field. The values would appear, but nothing would happen on node save. Strange...

Tags: 

Pages

Subscribe to Fragmented Thought RSS