Skip to content
Snippets Groups Projects
Commit 40bfc1c5 authored by Oliver Davies's avatar Oliver Davies
Browse files

Return NULL if the user hasn’t uploaded a picture

parent b66372be
No related branches found
No related tags found
No related merge requests found
......@@ -89,15 +89,20 @@ function bluecheese_election_candidate_ballot_item($variables) {
$candidate = $variables['candidate'];
$account = user_load($candidate->uid);
$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'),
),
));
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;
}
$full_name = theme('election_candidate_full_name', array('candidate' => $candidate));
$link = l($picture . $full_name, election_candidate_uri_path($candidate), array('html' => TRUE));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment