/**
  * Prepare posts collection
  *
  * @return void
  */
 protected function _preparePostCollection()
 {
     $this->_postCollection = $this->_postCollectionFactory->create()->addActiveFilter()->addStoreFilter($this->_storeManager->getStore()->getId())->setOrder('publish_time', 'DESC');
     if ($this->getPageSize()) {
         $this->_postCollection->setPageSize($this->getPageSize());
     }
 }
Exemplo n.º 2
0
 /**
  * @param string $name
  * @param string $primaryFieldName
  * @param string $requestFieldName
  * @param CollectionFactory $postCollectionFactory
  * @param DataPersistorInterface $dataPersistor
  * @param array $meta
  * @param array $data
  */
 public function __construct($name, $primaryFieldName, $requestFieldName, CollectionFactory $postCollectionFactory, DataPersistorInterface $dataPersistor, array $meta = [], array $data = [])
 {
     $this->collection = $postCollectionFactory->create();
     $this->dataPersistor = $dataPersistor;
     parent::__construct($name, $primaryFieldName, $requestFieldName, $meta, $data);
     $this->meta = $this->prepareMeta($this->meta);
 }
Exemplo n.º 3
0
 /**
  * Construct
  *
  * @param string $name
  * @param string $primaryFieldName
  * @param string $requestFieldName
  * @param CollectionFactory $collectionFactory
  * @param RequestInterface $request
  * @param array $meta
  * @param array $data
  */
 public function __construct($name, $primaryFieldName, $requestFieldName, CollectionFactory $collectionFactory, RequestInterface $request, array $meta = [], array $data = [])
 {
     parent::__construct($name, $primaryFieldName, $requestFieldName, $meta, $data);
     $this->collection = $collectionFactory->create();
     $this->request = $request;
 }
Exemplo n.º 4
0
 /**
  * Retrieve post collection with frontend filters and order
  * @return bool
  */
 protected function _getFrontendCollection()
 {
     $collection = $this->_postCollectionFactory->create();
     $collection->addActiveFilter()->addFieldToFilter('post_id', ['neq' => $this->getPost()->getId()])->addStoreFilter($this->_storeManager->getStore()->getId())->setOrder('publish_time', 'DESC')->setPageSize(1);
     return $collection;
 }