Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- namespace Acme\Package\TypoScript\FlowQueryOperations;
- use TYPO3\Eel\FlowQuery\FlowQuery;
- use TYPO3\Eel\FlowQuery\Operations\AbstractOperation;
- use TYPO3\Flow\Annotations as Flow;
- class MediaOperation extends AbstractOperation {
- /**
- * {@inheritdoc}
- *
- * @var string
- */
- static protected $shortName = 'media';
- /**
- * {@inheritdoc}
- *
- * @var integer
- */
- static protected $priority = 100;
- /**
- * @Flow\Inject
- * @var \TYPO3\Media\Domain\Repository\AssetRepository
- */
- protected $assetRepository;
- /**
- * {@inheritdoc}
- *
- * @param array (or array-like object) $context onto which this operation should be applied
- * @return boolean TRUE if the operation can be applied onto the $context, FALSE otherwise
- */
- public function canEvaluate($context) {
- return TRUE;
- }
- /**
- * @param FlowQuery $flowQuery the FlowQuery object
- * @param array $arguments
- * @return \TYPO3\Media\Domain\Model\AssetInterface
- */
- public function evaluate(FlowQuery $flowQuery, array $arguments) {
- $tag = $arguments[0];
- $flowQuery->setContext(array($this->assetRepository->findByTag($tag)));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement