Building a TYPO3 extension in Extbase/Fluid
Adding a non-standard/special frontend plugin
Sometimes you might want to add a plugin that will display a pre-filtered list instead of all records of your extension model. In order to do so, you’ll need to add a Repository class to your extension and edit the controller. Follow the steps listed in the topic Add a frontend plugin first.
After that go on like this (file paths are relative to the root of your extension /typo3conf/ext/your_extension/):
Add a method to your Model Repository that filters the records
class YourModelRepository extends \TYPO3\CMS\Extbase\Persistence\Repository
public function filteredList($filterVar)
// called in Classes/Controller/YourModelController->filteredListAction()
$query = $this->createQuery();
$query = $query->matching(
see also Extbase: Query and Repository Overview (external link)
Call the method defined in your Model Repository.
This example passes a configuration variable that has been set by the use of a so called FlexForm that can be added to a Content Element Form in the backend as “Plugin Options”. Read the topic Plugin Options (FlexForm) to learn how to do it.
class YourModelController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionController
* @var \VendorName\YourExtension\Domain\Repository\YourModelRepository
protected $yourModelRepository = NULL;
public function filteredListAction()
// calls the Repository method filteredList() assigning the flexform setting filterVar (<settings.flexform.filterVar> in /Configuration/FlexForms/flexform_xyz.xml)
// the variable $this->settings IS NOT AVAILABLE in the Repository!
$array_of_records = $this->yourModelRepository->filteredList($this->settings['flexform']['filterVar']);