helperData->getBlogConfig( 'sidebar/monthly_archive/enable_monthly', $this->helperData->getCurrentStoreId() ); } /** * @return array * @throws NoSuchEntityException */ public function getDateArrayCount() { return array_values(array_count_values($this->getDateArray())); } /** * @return array * @throws NoSuchEntityException */ public function getDateArrayUnique() { return array_values(array_unique($this->getDateArray())); } /** * @return array * @throws NoSuchEntityException */ public function getDateArray() { $dateArray = []; foreach ($this->getPostDate() as $postDate) { $dateArray[] = date("F Y", $this->dateTime->timestamp($postDate)); } return $dateArray; } /** * @return array * @throws NoSuchEntityException */ protected function getPostDate() { if (!$this->_postDate) { $posts = $this->helperData->getPostList(); $postDates = []; if ($posts->getSize()) { foreach ($posts as $post) { $postDates[] = $post->getPublishDate(); } } $this->_postDate = $postDates; } return $this->_postDate; } /** * @return int|void * @throws NoSuchEntityException */ public function getDateCount() { $limit = $this->helperData->getBlogConfig( 'sidebar/monthly_archive/number_records', $this->helperData->getCurrentStoreId()) ?: 5; $dateArrayCount = $this->getDateArrayCount(); $count = count($dateArrayCount); return ($count < $limit) ? $count : $limit; } /** * @param $month * * @return string */ public function getMonthlyUrl($month) { return $this->helperData->getBlogUrl($month, DataHelper::TYPE_MONTHLY); } /** * @return array * @throws Exception */ public function getDateLabel() { $postDates = $this->getPostDate(); $postDatesLabel = []; if (count($postDates)) { foreach ($postDates as $date) { $postDatesLabel[] = $this->helperData->getDateFormat($date, true); } } return array_values(array_unique($postDatesLabel)); } }