Advertisement
Guest User

Untitled

a guest
Mar 29th, 2017
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. public function getEntryDrafts($localeId = null)
  2. {
  3. if (!$localeId)
  4. {
  5. $localeId = craft()->i18n->getPrimarySiteLocale();
  6. }
  7.  
  8. $drafts = array();
  9.  
  10. $results = craft()->db->createCommand()
  11. ->select('*')
  12. ->from('entrydrafts')
  13. ->where(array('locale = :locale'), array(':locale' => $localeId))
  14. ->order('dateUpdated desc')
  15. ->queryAll();
  16.  
  17. foreach ($results as $result)
  18. {
  19. $result['data'] = JsonHelper::decode($result['data']);
  20.  
  21. // Don't initialize the content
  22. unset($result['data']['fields']);
  23.  
  24. $drafts[] = EntryDraftModel::populateModel($result);
  25. }
  26.  
  27. return $drafts;
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement