Exemplo n.º 1
0
 /**
  * @return \V3N0m21\Testimonials\Model\ResourceModel\Testimonial\Collection
  */
 public function getTestimonials()
 {
     if (!$this->hasData('testimonials')) {
         $testimonials = $this->_testimonialCollectionFactory->create()->addFilter('is_active', 1)->addOrder(TestimonialInterface::CREATION_TIME, TestimonialCollection::SORT_ORDER_DESC);
         $this->setData('testimonials', $testimonials);
     }
     return $this->getData('testimonials');
 }
Exemplo n.º 2
0
 /**
  * Execute action
  *
  * @return \Magento\Backend\Model\View\Result\Redirect
  * @throws \Magento\Framework\Exception\LocalizedException|\Exception
  */
 public function execute()
 {
     $collection = $this->filter->getCollection($this->collectionFactory->create());
     foreach ($collection as $item) {
         $item->setIsActive(false);
         $item->save();
     }
     $this->messageManager->addSuccess(__('A total of %1 record(s) have been disabled.', $collection->getSize()));
     /** @var \Magento\Backend\Model\View\Result\Redirect $resultRedirect */
     $resultRedirect = $this->resultFactory->create(ResultFactory::TYPE_REDIRECT);
     return $resultRedirect->setPath('*/*/');
 }