DEPRECATION WARNING

This documentation is not using the current rendering mechanism and is probably outdated. The extension maintainer should switch to the new system. Details on how to use the rendering mechanism can be found here.

Developer manual

Custom layouts

The registration of layouts requires following data:

  • Key of the layout (if it already exists, the former layout will be overriden)
  • Path to a Fluid template
  • Label (String or LLL)
  • Icon (optional)

Example:

\FORM4\Form4Teaser\Utility\ConfigurationUtility::addFluidLayout(
        'textpic',
        'Teaser/Textpic',
        'LLL:EXT:' . $_EXTKEY . '/Resources/Private/Language/locallang_db.xlf:settings.layout.items.textpic',
        FALSE
);

Custom sortings

The registration of sortings requires following data:

  • Key of the sorting (if it already exists, the former sorting will be overriden)
  • A callable (a anonymous function or a string referencing a function/method)
  • Label (String or LLL)
  • Icon (optional)

Example:

\FORM4\Form4Teaser\Utility\ConfigurationUtility::addSorting(
        'starttime',
        array('FORM4\\Form4Teaser\\Utility\\SortingsUtility', 'byStarttime'),
        'LLL:EXT:' . $_EXTKEY . '/Resources/Private/Language/locallang_db.xlf:settings.sorting.items.starttime',
        FALSE
);

Two parameters are provided to the callable:

  • $settings : array
  • $query : TYPO3CMSExtbasePersistenceQueryInterface

The $settings array should be used as reference (&$settings), so its content can be manipulated.

The $query object can be used to create constraints. If the callable returns a constraint or an array of constraint they are added to the query before its execution. However, we discourage to use these possibilities to implement other stuff than sorting

Example:

class SortingsUtility {
        public function byStarttime (&$settings, $query) {
                $settings['sortingField'] = 'starttime';
        }
}

Custom sorting directions

The registration and implementation of sorting directions is the same as of sortings.

Example:

\FORM4\Form4Teaser\Utility\ConfigurationUtility::addSortingDirection(
        'ascending',
        array('FORM4\\Form4Teaser\\Utility\\SortingDirectionsUtility', 'ascending'),
        'LLL:EXT:' . $_EXTKEY . '/Resources/Private/Language/locallang_db.xlf:settings.sortingDirection.items.asc',
        FALSE
);
class SortingDirectionsUtility {
        public function ascending (&$settings, $query) {
                $query->setOrderings(array(
                        $settings['sortingField'] => \TYPO3\CMS\Extbase\Persistence\QueryInterface::ORDER_ASCENDING
                ));
        }
}

Signal Slots

Class Name Signal Name Description Arguments
\FORM4\Form4Teaser\Domain\Repository\LargePageRepository modifyResults Modify the result after it was fetched from database
  • \TYPO3\CMS\Extbase\Persistence\QueryResultInterface $result
  • array $settings The plugin settings

Further information

If you want to remove existing layouts, sortings or sorting directions have a look at the API provided by the class FORM4Form4TeaserUtilityConfigurationUtility.