| | 24 | |
| | 25 | /** |
| | 26 | * Accepts an aReusableSlot or an array hydrated with the same columns. Returns the |
| | 27 | * actual Apostrophe slot being reused, or null if its page no longer exists or |
| | 28 | * it does not exist in the current version of its area on the page |
| | 29 | */ |
| | 30 | static public function getReusedSlot($reusableSlot) |
| | 31 | { |
| | 32 | $q = aPageTable::queryWithSlot($reusableSlot['area_name']); |
| | 33 | $q->andWhere('p.id = ?', $reusableSlot['page_id']); |
| | 34 | $q->andWhere('avs.permid = ?', $reusableSlot['permid']); |
| | 35 | $page = $q->fetchOne(); |
| | 36 | if (!$page) |
| | 37 | { |
| | 38 | return null; |
| | 39 | } |
| | 40 | $slots = $page->getSlotsByAreaName($reusableSlot['area_name']); |
| | 41 | if (!isset($slots[$reusableSlot['permid']])) |
| | 42 | { |
| | 43 | return null; |
| | 44 | } |
| | 45 | $slot = $slots[$reusableSlot['permid']]; |
| | 46 | return $slot; |
| | 47 | } |