Drupal Step-by-Step: How We Built Our Training Site, Part 1

Post on 07-May-2015

2.561 views 0 download

Transcript of Drupal Step-by-Step: How We Built Our Training Site, Part 1

Drupal Step-by-Step: How We Built Our Training site

(part 1)Site architecture and construction

We use preprocess_field to style the buttons (class, icon, popup text).

class TrainingNodeEventMigration extends DrupalNode6Migration { public function __construct(array $arguments) { parent::__construct($arguments); }

protected function query() { // Pull in the default parent query and add our own join to it. $query = parent::query(); // Join the location tables, as they're not CCK, so migrate can't see them by // itself. These fields will now appear in the d2d ui. $query->join('location_instance', 'i', 'i.nid = n.nid AND i.vid = n.vid'); $query->join('location', 'l', 'l.lid = i.lid'); $query->fields('l', array('name', 'street', 'additional', 'city', 'province', 'postal_code', 'country', 'latitude', 'longitude', 'source')); return $query; }...

public function prepareRow($row) { // Date value2 is the end time. $event_date = strtotime($row->{'field_date:value2'}); $now = strtotime('now');

if ($now > $event_date) { // This excludes the node. return FALSE; }

// Everything else is allowed. return TRUE; }