Fluid Iterator + Modulo

<f:for each="{example.collection}" as="item"  iteration="iterator"  >
   <f:if condition="{iterator.index} % 2">
     <f:then>Rest</f:then>
      <f:else>
          <f:if condition="{iterator.index}==0">
              <f:then>First</f:then>
              <f:else>kein Rest</f:else>
          </f:if>
      </f:else>
   </f:if>
</f:for>

Widget->PaginateViewHelper

plugin.tx_infochy_example{
    view {
        widget {
            TYPO3\CMS\Fluid\ViewHelpers\Widget\PaginateViewHelper {
                templateRootPath = {$plugin.tx_infochy_example.view.templateRootPath}
            }
        }
    }
}

Fluid – News Artikel der letzten 5 Tage mit UPDATE oder NEW makieren

// Datum des Artikels: {newsItem.datetime}
// Datum der letzten Artikel Bearbeitung: {newsItem.tstamp}
// Datensatz wurde erzeugt am: {newsItem.crdate}

NEW

<f:if condition="{f:format.date(date: newsItem.datetime, format: 'Y-m-d')} > {f:format.date(date: '-5 days' format: 'Y-m-d')}">
NEW
</f:if>

UPDATE

<f:if condition="{f:format.date(date: newsItem.tstamp, format: 'Y-m-d')} > {f:format.date(date: '-5 days' format: 'Y-m-d')}">
UPDATE
</f:if>

f:widget.paginate – Suchparameter übergeben

addQueryStringMethod: ‚POST,GET‘

<f:widget.paginate objects="{DomainObjs}" as="paginatedDomainObjs" configuration="{itemsPerPage: 1, insertAbove: 1, insertBelow: 0, maximumNumberOfLinks: 5, addQueryStringMethod: 'POST,GET'}">

addQueryString=“1″

<f:link.action action="show" arguments="{DomainObj : DomainObj}" addQueryString="1"> 

Fluid – Exception bei prependOptionLabel & prependOptionValue

FLUID

<f:form.select property="Option" options="{Option}" optionValueField="uid" optionLabelField="title" prependOptionValue=""  prependOptionLabel="Bitte wählen"/>

Exception:

Exception while property mapping at property path „“: PHP Catchable Fatal Error: Argument 1 passed to …

Lösung: $option = null

/**
 * Sets the option
 *
 * @param \VendorName\ExtensionName\Domain\Model\Option $option
 * @return void
 */
public function setOption(\VendorName\ExtensionName\Domain\Model\Option $option = null)
{
    $this->option = $option;
}

Extbase FeUser Example Extension

GIT: https://github.com/wallpageNET/infochy_feuserexample
TER: https://typo3.org/extensions/repository/view/infochy_feuserexample

Model

    /**
     * user
     *
     * @var \TYPO3\CMS\Extbase\Domain\Model\FrontendUser
     */
    protected $user;
    
    /**
     * Returns the user
     *
     * @return \TYPO3\CMS\Extbase\Domain\Model\FrontendUser $user
     */
    public function getUser() {
        return $this->user;
    }

    /**
     * Sets the user
     *
     * @param \TYPO3\CMS\Extbase\Domain\Model\FrontendUser $user
     * @return void
     */
    public function setUser($user) {
        $this->user = $user;
    }

Controller

    /**
     * action create
     *
     * @param \Infochy\InfochyFeuserexample\Domain\Model\MyData $newMyData
     * @return void
     */
    public function createAction(\Infochy\InfochyFeuserexample\Domain\Model\MyData $newMyData)
    {
        $this->addFlashMessage('createAction ADD FrontendUser', '', \TYPO3\CMS\Core\Messaging\AbstractMessage::ERROR);       

		
	$newMyData->getUser()->addUsergroup($this->getFrontendUserGroup());          
        $this->myDataRepository->add($newMyData);
        $this->redirect('list');
    }
    
    private function getFrontendUserGroup(){
    	$frontendUserGroups = $this->frontendUserGroupRepository->findByTitle('InfochyFeuserexample');
		$frontendUserGroup = $frontendUserGroups->getFirst();
		if(!is_null($frontendUserGroup)){
			return $frontendUserGroup;
		}else{
			$frontendUserGroup = $this->objectManager->get('TYPO3\CMS\Extbase\Domain\Model\FrontendUserGroup');
			$frontendUserGroup->setTitle('InfochyFeuserexample');
			$frontendUserGroup->setDescription('Title display only on Sys-Pages');
			$this->frontendUserGroupRepository->add($frontendUserGroup);
			$persistenceManager =  $this->objectManager->get('TYPO3\CMS\Extbase\Persistence\Generic\PersistenceManager');
			$persistenceManager->persistAll();	
	    	$frontendUserGroups = $this->frontendUserGroupRepository->findByTitle('InfochyFeuserexample');
			return $frontendUserGroups->getFirst();					
		}
    }

Controller -> frontendUserGroupRepository

    /**
     * frontendUserGroupRepository
     *
     * @var \TYPO3\CMS\Extbase\Domain\Repository\FrontendUserGroupRepository
     * @inject
     */
    protected $frontendUserGroupRepository = NULL;

TCA

		'user' => array(
			'exclude' => 1,
			'label' => 'Fe User',
			'config' => array(
				'type' => 'inline',
				'foreign_table' => 'fe_users',
				'minitems' => 0,
				'maxitems' => 1,
				'appearance' => array(
					'collapseAll' => 0,
					'levelLinksPosition' => 'top',
					'showSynchronizationLink' => 1,
					'showPossibleLocalizationRecords' => 1,
					'showAllLocalizationLink' => 1
				),
			),
		),	

Fluid-HTML

<label for="user.username">
	FeUser->username
</label><br />
	<f:form.textfield property="user.username" /><br />
	
<label for="user.password">
	FeUser->password
</label><br />
	<f:form.textfield property="user.password" /><br />
	
<label for="user.name">
	FeUser->name
</label><br />
	<f:form.textfield property="user.name" /><br />
	
<label for="user.email">
	FeUser->email
</label><br />
	<f:form.textfield property="user.email" /><br />

GET templateRootPath

$templateRootPath = \TYPO3\CMS\Core\Utility\GeneralUtility::getFileAbsFileName($config['view']['templateRootPath']);