Posts

Showing posts from September, 2011

Configuring drush on Mac OS X Lion

I downloaded the drush from the drupal website at http://drupal.org/project/drush. I downloaded the 7.x-4.5 version -  I was using mac os x and if you are also using mac os or any other flavour of linux - you should download the tar.gz file.  Drush works best on linux/mac os x - it works on windows as well but has its limitations, although things are improving but you will need to install additional software that allows you to use many drush functions. If you are interested to look at how to install drush on windows then have a look at drush.ws. I did install on my old windows pc as well, got most of it working. Coming back to the topic, we are installing on mac os x - so here goes. The accompanying readme.txt file is quite good in showing what is required, and it really is straight forward. Albeit there are a few differences and may be you would like to customise your installation a little bit - but this is what i did. The first step was to download and extract the dr

How do you expose your legacy database tables to views in drupal 6 Part 2

Continuing from Part 1 of the post where we defined custom data table to make drupal aware of our legacy data, we also want to define custom filters that can be used by the views system to define conditional views. in the hook_views_data() or our example code in part one, the candidate_views_data() function you can see that a field was defined as below:     $data [ 'candidate' ][ 'candidate_gender' ] = array (         'title' => t( 'Gender' ),         'field' => array (           'click sortable' => TRUE ,         ),         'filter' => array (             'handler' => 'candidate_handler_filter_gender' ,         ),     ); notice the filter key in the $data array, we want custom data to appear here, for example 'Male' and 'Female', so we have defined a custom handler by the name ' candidate_handler_filter_gender '. to make drupal aware o

How do you expose your legacy database tables to views in drupal 6 Part 1

This is a 2 part post, that shows how I exposed a legacy table to views in drupal and used the incredible power of views to create many combinations static and conditional views. This was very helpful for my client. I had a requirement that warranted exposing existing database table to views, so that views can contain data from this table.  To enable this to happen, the following steps need to be taken. In a custom module you need to first define the views_api hook as following: function candidate_views_api(){     $view = array ();     $view = array ( 'api' => 2 ,                   'path' => drupal_get_path( 'module' , 'candidate' ). '/views' );     return $view ; } candidate module was a custom module which I already had, so it made sense to add this hook here.  The important bit here is telling the drupal sub-system where the views file will reside.  Then create a file with your <modulename>.