I just updated the design on this website (finally!) and needed to make image sprites for the github/twitter/linkedin icons. I know there's ways to create image sprite sets NodeJS and Gulp/Grunt, but what's the fun in that!?
Often while building a Drupal website, you'll need to create a custom Block containing HTML and content. Completely standard right? It's a problem when your client or the site maintainer needs to change some of that content. They are forced to wade through significant amounts of HTML to find that little bit of content to update. Instead, why don't you build a custom settings page? Your site maintainer gets a simple form to update and you get variables to output.
The Node, Views and Panels modules can (and should!) handle most pages you need on a site, but sometimes you need complete control of a "hard coded" content area. You could create a new Page node with a Full HTML text format. Instead, how about putting the whole thing in code? Your work will be in version control and much more straightforward to maintain. Imagine editing HTML in a text editor rather than in the Drupal admin! So much better.
A common issue when building a site in Drupal: you've got a $node, $vars['node'], or $form_state['node'] and need to render an image (with image style) from one of the fields. I am building a custom form in this instance, and need to show the first image stored in some loaded nodes.
This is a simple example of the use of Views hooks in the template.php file of a theme. It is written for use with Drupal 7 and Views 7.x-3.0-beta3.
In this project, a page contains a View which must display one, two or three results/rows. Each row contains an image and and body text. The final output display must to stay roughly the same size regardless of the amount of content. To make it all fit and allow for custom theming/CSS, I decided to change the Image Style and Row Class depending on the number of results.
Much of the styling and theming a designer specifies in a Drupal design mockup can be easily implemented. Once in a while, you'll run into a request that seems simple, but gets far more involved.
A common web design feature is to move the label for a form field into the field value, then clear the field once it gains focus. There are many ways to implement this functionality, but this is the Drupal 7 theming method.
- Open your template.php file.
- We will use hook_form_alter() to change the value of the search field: