Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Model for form-filter
- --------------------------------------------------------------------------------
- class Filterdemand extends \TYPO3\CMS\Extbase\DomainObject\AbstractDomainObject {
- /**
- * Sys-testings set within filter-form
- * @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\Vendor\Medialibrary\Domain\Model\Test>
- */
- protected $testings;
- /**
- * __construct
- *
- * @return AbstractObject
- */
- public function __construct() {
- $this->testings = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
- }
- /**
- * Returns the testings
- *
- * @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\Vendor\Medialibrary\Domain\Model\Test> $testings
- */
- public function getTestings() {
- return $this->testings;
- }
- /**
- * Sets the testings
- *
- * @param $testings testings
- * @return void
- */
- public function setTestings($testings) {
- $this->testings = $testings;
- }
- }
- Model of records parsed through ForViewHelper
- --------------------------------------------------------------------------------
- class Test extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity {
- /**
- * Title of entry
- *
- * @var string
- */
- protected $title;
- /**
- * Returns the title
- *
- * @return string $title
- */
- public function getTitle() {
- return $this->title;
- }
- /**
- * Sets the title
- *
- * @param string $title
- * @return void
- */
- public function setTitle($title) {
- $this->title = $title;
- }
- }
- Controller (for different records than the ones parsed through ForViewHelper)
- --------------------------------------------------------------------------------
- class AsdfController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionController {
- /**
- * testRepository
- *
- * @var \Vendor\Medialibrary\Domain\Repository\TestRepository
- * @inject
- */
- protected $testRepository;
- /**
- * @var \TYPO3\CMS\Extbase\Object\ObjectManagerInterface
- * @inject
- */
- protected $objectManager;
- /**
- * action list
- *
- * @param Vendor\Medialibrary\Domain\Model\Filter $filter Filter set within form
- * @return void
- */
- public function listAction(\Vendor\Medialibrary\Domain\Model\Filterdemand $filterdemand = NULL) {
- $testings = $this->testRepository->findAll();
- $filterdemand = $this->objectManager->get('Vendor\\Medialibrary\\Domain\\Model\\Filterdemand');
- $filterdemand->setTestings($testings);
- $this->view->assignMultiple(array(
- 'testings' => $testings,
- 'filterdemand' => $filterdemand,
- ));
- }
- }
- View
- --------------------------------------------------------------------------------
- <f:form action="list" name="filter" object="{filterdemand}">
- <fieldset>
- <f:for each="{testings}" as="test">
- <f:form.checkbox value="{test.uid}" property="testings" id="testings{test.uid}" /><label for="testings{test.uid}">{test.title}</label><br />
- </f:for>
- </fieldset>
- <fieldset>
- <f:form.submit value="Filtern" />
- </fieldset>
- </f:form>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement