Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions plugins/content_types/loans.inc
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,30 @@ function ding_loan_loans_form($form, &$form_state, $account, $loans = array()) {
$title = l($entity->getTitle(), $uri['path']);
}

// Add creator(s).
$creators = $entity->creators;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code seams to be the same as in https://github.com/ding2/ding_reservation/pull/10/files would it be possible to move this to an utility function or maybe into an pre-process in ding_base? As the information in both places is used by "material_item" theme function.

if(!is_array($creators)){
$creators = array($creators);
}

$creator_string = '';
if(!empty($creators)) {
foreach ($creators as $creator) {
if (!empty($creator_string)) {
$creator_string .= ', ';
}
$creator_string .= $creator;
}
$creator_string .= ' :';
}

// Add type.
$mat_type = $entity->type;
$item = array(
'#type' => 'material_item',
'#id' => $loan->id,
'#creators' => $creator_string,
'#material_type' => $mat_type,
'#title' => $title,
'#cover' => field_view_field('ting_object', $entity, 'ting_cover', 'user_list'),
'#information' => array(
Expand Down