Skip to content

Instantly share code, notes, and snippets.

@sorenmalling
Created June 20, 2014 08:30
Show Gist options
  • Select an option

  • Save sorenmalling/7dbba5c4efef22b92797 to your computer and use it in GitHub Desktop.

Select an option

Save sorenmalling/7dbba5c4efef22b92797 to your computer and use it in GitHub Desktop.
class CategoryService {
/**
* Build category selector
*
* @param array $config array (passed by reference) which contains the current information about the current field being rendered
* @param \TYPO3\CMS\Backend\Form\FormEngine $formEngine a reference to the parent object (an instance of the t3lib_TCEforms class).
*
* @return string
*/
public function categorySelector($config, \TYPO3\CMS\Backend\Form\FormEngine &$formEngine) {
$categories = $GLOBALS['TYPO3_DB']->exec_SELECT_mm_query('sys_category.uid, sys_category.title, sys_category_record_mm.locked', 'sys_category', 'sys_category_record_mm', $config['table'], 'AND uid_foreign = ' . $config['row']['uid'], '', 'sys_category.title');
while ($currentCategories[] = $GLOBALS['TYPO3_DB']->sql_fetch_row($categories)) {
}
array_pop($currentCategories);
$javscript = '
<script type="text/javascript" src="/typo3conf/ext/bolius_products/Resources/Public/Scripts/Suggest.js" ></script>
';
$formEngine->additionalCode_pre['tx_boliusproducts_categoryselector'] = $javscript;
'type' => 'user',
'userFunc' => 'Bolius\\BoliusProducts\\Service\\CategoryService->categorySelector'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment