Drupal design patterns
I decided to do some research on how Drupal 7 uses some of the popular Design patterns and was pleasantly surprised. In this post I will go over some that I have found. Observer Pattern & Visitor Pattern http://www.oodesign.com/observer-pattern.html http://www.oodesign.com/visitor-pattern.html Before understanding the Observer and Visitor patterns in Drupal you have to understand the hook system. Drupal uses a hook system where developers can register and alter information in Drupal. This allows you to create functionality without having to alter core and contributed code. The observer pattern has an object (subject) that maintains a list of other objects (observers) and notifies them whenever changes occur. An example of an Observer pattern in Drupal is hooking into the user log in functionality using hook_user_login(). The example below registers our observer with Drupal and is notified whenever the user logs in. <?php /** * Implements hook_user_login(). * * @param $edit * @param
Drupal 8 Livecast
Over the next month or so I will be doing a weekly live screen cast with AlphaStax LLC on creating a Drupal 8 site. Please join me by watching below or going to the YouTube page.
drupal ds display suite fields
Display suite (DS) is a powerful tool that allows you to create flexible content on Drupal. While Display Suite is great for layouts there are often times when your fields are not compatible with the DS UI. In this situation you are forced to use a preprocess function, templates, or other methods to display the content. This blog post will take you through how to use the Display Suite API to create a custom field using PHP. I am going to assume that you have knowledge about how Display Suite works and how to create a simple module. The example will be taking an image field and a link field to create a custom field where the image will have a link surrounding it. The first step is telling Display suite about the field using hook_ds_fields_info(). <?php /** * Implements hook_ds_fields_info(). * * @return array */ function ds_example_ds_fields_info() { $fields['image_link']
wamp windows virtual hosts
If you have been developing long you understand that sub domains and vhosts are essential in development. This article will explain how to set up a sub domain using WAMP. I will assume you have installed wamp and have a working knowledge of how to start, stop, and restart using the control panel or any other methods. Create your site First step is to create your site in the C:\wamp\www folder. Note this tutorial will not go over how to have sites outside of this folder but it is certainly possible. Navigate into the www folder and create a new folder, or move an existing site into this folder. Edit your httpd.conf file Next step is to go in and edit your httpd.conf file. It is located in the C:\wamp\bin\apache\apache2.4.9\conf\httpd.conf folder. In here we need to edit 3 sections. The first thing we need to do is enabled mod_rewrite. Look
git command line
Using version control on your code is not just for the big boys in corporate offices. It can be used by a one person freelancer like yourself. In fact you do not even need to use proper git branching to benefit from using GIT and can work strictly off of the master. There are several benefits of using GIT including: code management, code reverting, tracking changes, and code deployment. First step we will set up a repository Setting up repository Set up your repository by using the git init and git remote add commands mkdir /path/to/your/project cd /path/to/your/project git init git remote add origin <path-to-repository> Committing files to your repository Now that we have set up the repository lets make the commits. Note you can add a file specifically or add all your files by using git *. Keep in mind if you have any hidden files git * will