Example #1
0
 /**
  * Get options
  *
  * @return array
  */
 public function toOptionArray()
 {
     $options[] = ['label' => '', 'value' => ''];
     $availableOptions = $this->testimonial->getAvailableStatuses();
     foreach ($availableOptions as $key => $value) {
         $options[] = ['label' => $value, 'value' => $key];
     }
     return $options;
 }
Example #2
0
 /**
  * @param Action $action
  * @param null $testimonialId
  * @return \Magento\Framework\View\Result\Page|bool
  */
 public function prepareResultPost(Action $action, $testimonialId = null)
 {
     if ($testimonialId !== null && $testimonialId !== $this->_testimonial->getId()) {
         $delimiterPosition = strrpos($testimonialId, '|');
         if ($delimiterPosition) {
             $testimonialId = substr($testimonialId, 0, $delimiterPosition);
         }
         if (!$this->_testimonial->load($testimonialId)) {
             return false;
         }
     }
     if (!$this->_testimonial->getId()) {
         return false;
     }
     /** @var \Magento\Framework\View\Result\Page $resultPage */
     $resultPage = $this->resultPageFactory->create();
     $resultPage->addHandle('blog_post_view');
     $resultPage->addPageLayoutHandles(['id' => $this->_testimonial->getId()]);
     $this->_eventManager->dispatch('v3n0m21_testimonials_testimonial_render', ['testimonial' => $this->_testimonial, 'controller_action' => $action]);
     return $resultPage;
 }