Monthly Archives: June 2013

Content-aware Block View

Drupal 7 Views – How to Make Content-aware View Blocks

On the gench site I’m currently working on, I wanted to display a song and audio player on each CD product page. I have two content types I used for this: “Product display” with most of the CD information (title, artist, label, cover image, price, etc.) and “Song” which includes the mp3/player, song title and an entity reference field that points back to the Product display.

I knew I wanted each Product display page to display the song/player in the Second side bar. I suppose I could have created a view and block for each song and then used each view block’s config to display each on the appropriate Product display page. But this seemed like madness to me! Is the client to be expected to create a new song, view and block each time they want to add a product/CD?! True, the client in this case is “only” my husband, but he’s generally a decent guy, so I figured there had to be a better way. Continue reading

Using PHP to Control Layout of a Drupal Webform

A webform’s layout can be controlled by PHP.

Say I want to take this webform…

Webform - before

Webform – before: the student’s name is on 3 separate lines

…and put the 3 Student’s name fields (Student’s first name, Student’s middle name & Student’s last name) on the same line together like this…

Webform – after

Webform – after: the student’s name is now on 1 line

Continue reading