public function formPostData(WP_Query $wpq, erpPROOptions $optionsObj, $ratings = array()) { erpPROPaths::requireOnce(erpPROPaths::$erpPROPostData); $from = get_the_ID(); $data = array('title' => $optionsObj->getValue('title'), 'options' => $this->options, 'uniqueID' => $this->uniqueID, 'optionsObj' => $optionsObj, 'posts' => array()); while ($wpq->have_posts()) { $wpq->the_post(); $rating = isset($ratings[get_the_ID()]) ? $ratings[get_the_ID()] : null; $postData = new erpPROPostData($wpq->post, $optionsObj, $rating, $from); if ($optionsObj->haveToShowExcerpt()) { $postData->setExcerpt($optionsObj->getValue('excLength'), $optionsObj->getValue('moreTxt')); } if ($optionsObj->haveToShowThumbnail()) { $postData->setThumbnail($optionsObj->getDefaultThumbnail()); } array_push($data['posts'], $postData); } wp_reset_postdata(); $this->setAdditionalViewData(array_merge($data, $this->options)); return $this; }