Skip to content

Instantly share code, notes, and snippets.

View nostadt's full-sized avatar
🧭

Alexander Nostadt nostadt

🧭
View GitHub Profile
@nostadt
nostadt / ext_localconf.php
Last active June 18, 2019 11:28
Register Backend Module with Icon from FontAwesome (Tested with 8 LTS)
<?php
if (!defined('TYPO3_MODE')) {
die('Access denied.');
}
(function () {
$iconRegistry = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Imaging\IconRegistry::class);
// Icons from: https://fontawesome.com/v3.2.1/icons/
foreach (['shopping-cart', 'search'] as $icon) {
@nostadt
nostadt / SelectSingleWithNullElement.php
Last active June 7, 2019 08:23
Get nullable checkbox for SelectSingleElement (Dropdown) in T3 TCA back
<?php
namespace Vendor\MyExt\Form\Element;
use TYPO3\CMS\Backend\Form\Element\SelectSingleElement;
use TYPO3\CMS\Backend\Form\InlineStackProcessor;
use TYPO3\CMS\Backend\Form\Utility\FormEngineUtility;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Utility\StringUtility;
@nostadt
nostadt / TYPO3 8 LTS & 9 LTS - work with transactions
Created May 22, 2019 13:41
TYPO3 8 LTS & 9 LTS - work with transactions
<?php
$connection = GeneralUtility::makeInstance(ConnectionPool::class)->getConnectionForTable('tx_foo_yourtable');
$connection->transactional(function (Connection $connection) {
// Perform transactional queries here
});
// Code from Mathias wild Brodala. For quick reference I created a gist.