function _showGalleryImages($data, $fieldname) { if (isset($data['id'])) { $this->setFieldValueSet('img', AMPContentLookup_GalleryImages::instance($data['id'])); return $data['id']; } }
function getImageFilename($choose_rand = false) { $value = $this->getData('img'); if ($value || !$choose_rand) { return $value; } $all_images =& AMPContentLookup_GalleryImages::instance($this->id); if (empty($all_images)) { return false; } $just_images = array_values($all_images); return $just_images[rand(0, count($all_images) - 1)]; }