.. _templating:
Templating with fluid
======================
.. only:: html
**Table of content:**
.. contents::
:local:
:depth: 1
.. _templating-form:
Templating a form
-----------------
Example :
Php code
::
$mymodel = $this->myModelRepository->findByUid($modelIdentifier);
$form = \Ameos\AmeosForm\Form\Factory::make('tx_myplugin', $mymodel);
$form->add('name', 'text')->addConstraint('name', 'required', 'Name is mandatory');
$form->add('email', 'email')->addConstraint('email', 'email', 'Email is not valid');
$form->add('submit', 'submit', array('label' => 'Send'));
$this->view->assign('form', $form);
Template html
::
{namespace form=Ameos\AmeosForm\ViewHelpers}
{error}
.. _templating-list:
Templating a list
-----------------
Example :
Php code (search action)
::
$searchform = \Ameos\AmeosForm\Form\Factory::make('tx_myplugin', $this->myModelRepository);
$searchform->add('name', 'text');
$searchform->add('email', 'email');
$searchform->add('submit', 'submit', array('label' => 'Search'));
$template = ExtensionManagementUtility::extPath('my_ext') . 'Resources/Private/Templates/Controller/List.html';
$list = $this->objectManager->create(\Ameos\AmeosForm\Library\RecordList::class, $searchform, $template, $this->controllerContext);
$this->view->assign('my-searchform', $searchform);
$this->view->assign('my-list', $list);
Template html Search.html
::
{namespace form=Ameos\AmeosForm\ViewHelpers}
Template html List.html
::
{namespace form=Ameos\AmeosForm\ViewHelpers}
|
|
{record.name} |
{record.email} |