From 4f4a69ef316efc22de55f52266a73202d1522cc4 Mon Sep 17 00:00:00 2001
From: Oliver Davies <oliver@oliverdavies.co.uk>
Date: Wed, 25 Feb 2015 18:31:56 +0000
Subject: [PATCH] Moved candidate picture logic to
 association_drupalorg_candidate_picture()

---
 template.php | 16 +---------------
 1 file changed, 1 insertion(+), 15 deletions(-)

diff --git a/template.php b/template.php
index f89ebbd1..d3711846 100644
--- a/template.php
+++ b/template.php
@@ -89,21 +89,7 @@ function bluecheese_election_candidate_ballot_item($variables) {
   $candidate = $variables['candidate'];
   $account = user_load($candidate->uid);
 
-  if (!empty($candidate->field_election_picture)) {
-    $picture = theme('image_style', array(
-      'style_name' => 'candidate_thumbnail',
-      'path' => $candidate->field_election_picture[LANGUAGE_NONE][0]['uri'],
-      'alt' => t('@user’s picture', array('@user' => format_username($account))),
-      'attributes' => array(
-        'title' => t('View user picture'),
-        'class' => array('candidate-picture'),
-      ),
-    ));
-  }
-  else {
-    $picture = NULL;
-  }
-
+  $picture = association_drupalorg_candidate_picture($candidate, $account);
   $full_name = theme('election_candidate_full_name', array('candidate' => $candidate));
   $link = l($picture . $full_name, election_candidate_uri_path($candidate), array('html' => TRUE));
 
-- 
GitLab