PHP code example of liquidlight / typo3-call-to-actions

1. Go to this page and download the library: Download liquidlight/typo3-call-to-actions library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

liquidlight / typo3-call-to-actions example snippets




defined('TYPO3_MODE') or die();

call_user_func(function () {
	$columns = [
		'tx_sitepackage_call_to_actions' => [
			'label' => 'LLL:EXT:call_to_actions/Resources/Private/Language/locallang.xlf:call_to_actions',
			'config' => [
				'default' => '12',
				'type' => 'select',
				'renderType' => 'selectMultipleSideBySide',
				'foreign_table' => 'tx_calltoactions_domain_model_calltoactions',
				'foreign_table_where' => 'AND tx_calltoactions_domain_model_calltoactions.sys_language_uid IN (-1,0)
					ORDER BY tx_calltoactions_domain_model_calltoactions.title ASC',
				'minitems' => 0,
				'maxitems' => 100,
				'size' => 10,
			],
		],
	];
	\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTCAcolumns('tt_news', $columns);
	\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addToAllTCAtypes(
		'tt_news',
		'tx_sitepackage_call_to_actions',
		'',
		'after:bodytext'
	);
});

$cObj = GeneralUtility::makeInstance(ContentObjectRenderer::class);

/**
 * Promos
 */
// Get the default config
$ctas = $GLOBALS['TSFE']->tmpl->setup['tt_content.']['call_to_actions.'];
// Set the records to be our UIDs
$ctas['dataProcessing.']['100.']['uidInList'] = $record['promos'];
// Remove the field gathering
unset($ctas['dataProcessing.']['100.']['uidInList.']);
// Render the element
$record['promos'] = $cObj->cObjGetSingle('FLUIDTEMPLATE', $ctas);