sublime_text

Top 5 Drupal 7 Code Snippets

As a seasoned Drupal developer you tend to accumulate a bunch of code snippets that you will usually use on most of your projects! Most of these are very simple but can be helpful to beginners when learning Drupal and diving into theme building! The first thing i do in every project is adjust my template file to allow me to create templates for my content types. This code snippet has saved time in development because I can easily create a content type and then know exactly which page template I can create to manipulate the fields and display the content the way I need it to be. Another code snippet I use in almost every theme is a foreach loop to pull all of the elements in a multi content field. Here are 5 of my favorite code snippets!

1. Preprocess Page – template.php

2. Pulling Fields Inside Page Template

3. Looping Through Multi Image Fields
This can be used on any type of multi field not just images

4. Check to see if a field has a value

5. Custom Menu Styles – template.php

Related Posts

blogfile A Simple Blogging Platform: BlogFile sublime_text My Top WordPress Code Snippets