Use default image for candidates who have signed the ledge, but not provided an image.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
function parse_pledge_data($candidates_files) {
|
||||
function parse_pledge_data($candidates_files, $default_image) {
|
||||
$candidate_data = [];
|
||||
foreach ($candidates_files as $key => $file) {
|
||||
$config_file = dirname($file)."/config.json";
|
||||
@@ -19,8 +19,13 @@ function parse_pledge_data($candidates_files) {
|
||||
$candidate = [];
|
||||
$candidate['Pledge'] = 'n';
|
||||
$candidate['Picture'] = "";
|
||||
$candidate['image_url'] = "";
|
||||
$candidate['image_id'] = "";
|
||||
if (is_array($default_image)) {
|
||||
$candidate['image_url'] = $default_image['url'];
|
||||
$candidate['image_id'] = $default_image['id'];
|
||||
} else {
|
||||
$candidate['image_url'] = "";
|
||||
$candidate['image_id'] = "";
|
||||
}
|
||||
foreach ($headers as $key => $value) {
|
||||
$candidate[$value] = $data[$key];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user