/** * Get data * * @param NodeInterface $node The node that is currently edited (optional) * @param array $arguments Additional arguments (key / value) * @return array JSON serializable data */ public function getData(NodeInterface $node = NULL, array $arguments) { $collections = $this->instagramCollectionRepository->findAll(); /* @var \Weissheiten\Neos\InstagramMedia\Domain\Model\InstagramCollection $col */ foreach ($collections as $col) { /*$rv[] = array('value' => json_encode(array('__identity' => $this->persistenceManager->getIdentifierByObject($col), '__type' => '\Weissheiten\Neos\InstagramMedia\Domain\Model\InstagramCollection')),*/ $rv[] = array('value' => $this->persistenceManager->getIdentifierByObject($col), 'label' => $col->getTitle()); } return $rv; }
/** * Delete an InstagramCollection * * @param InstagramCollection $instagramCollection * @return void * */ public function deleteInstagramCollectionAction(InstagramCollection $instagramCollection) { $this->instagramCollectionRepository->remove($instagramCollection); /* $this->addFlashMessage(sprintf('Collection "%s" has been deleted.', htmlspecialchars($instagramCollection->getTitle()))); */ $this->redirect('index'); }
/** * @param array $configuration Source configuration * * @return mixed */ public function instagramMediaQueryByCollection(array $configuration) { if (!isset($configuration[0]) || !is_string($configuration[0])) { throw new \TYPO3\Eel\EvaluationException('InstagramMediaQuery first parameter: needs an string that sets the title of the collection to fetch'); } if (!isset($configuration[1]) || !is_numeric($configuration[1])) { throw new \TYPO3\Eel\EvaluationException('mediaLibrary second parameter: needs a numeric value that defines the number of objects to fetch from the instagram collection'); } $collectionIdentifier = $configuration[0]; $limit = $configuration[1]; /* @var \Weissheiten\Neos\InstagramMedia\Domain\Model\InstagramCollection $collection */ $collection = $this->instagramRepository->findByIdentifier($collectionIdentifier); $flavorImages = []; // a collection has been found if ($collection !== null) { $flavorImages = $collection->getInstagramImages()->slice(0, $limit); } return $flavorImages; }