Changeset View
Changeset View
Standalone View
Standalone View
src/applications/pholio/view/PholioMockImagesView.php
Show First 20 Lines • Show All 104 Lines • ▼ Show 20 Lines | foreach ($mock->getImages() as $image) { | ||||
'title' => $image->getName(), | 'title' => $image->getName(), | ||||
'descriptionMarkup' => $description, | 'descriptionMarkup' => $description, | ||||
'isObsolete' => (bool)$image->getIsObsolete(), | 'isObsolete' => (bool)$image->getIsObsolete(), | ||||
'isImage' => $file->isViewableImage(), | 'isImage' => $file->isViewableImage(), | ||||
'isViewable' => $file->isViewableInBrowser(), | 'isViewable' => $file->isViewableInBrowser(), | ||||
); | ); | ||||
} | } | ||||
$ids = mpull($mock->getActiveImages(), 'getID'); | $ids = mpull($mock->getActiveImages(), null, 'getID'); | ||||
epriestley: This fixes a sort-of-bug. The `mpull()` intends to rekey the array (the lines below care about… | |||||
if ($this->imageID && isset($ids[$this->imageID])) { | if ($this->imageID && isset($ids[$this->imageID])) { | ||||
$selected_id = $this->imageID; | $selected_id = $this->imageID; | ||||
} else { | } else { | ||||
$selected_id = head_key($ids); | $selected_id = head_key($ids); | ||||
} | } | ||||
$navsequence = array(); | $navsequence = array(); | ||||
foreach ($mock->getActiveImages() as $image) { | foreach ($mock->getActiveImages() as $image) { | ||||
▲ Show 20 Lines • Show All 102 Lines • Show Last 20 Lines |
This fixes a sort-of-bug. The mpull() intends to rekey the array (the lines below care about the array keys) but changes the values instead. The code worked before because the array happened to always be keyed by ID anyway.