Skip to content

Instantly share code, notes, and snippets.

View kitzberger's full-sized avatar

Philipp Kitzberger kitzberger

View GitHub Profile
@kitzberger
kitzberger / setup.typoscript
Created November 25, 2021 04:04
Prepend <i>-tag to link text of typolinks
lib.parseFunc {
tags.a.stdWrap {
prepend = COA
prepend {
10 = LOAD_REGISTER
10.linktype = TEXT
10.linktype {
data = parameters:href
replacement {
10 {
@kitzberger
kitzberger / rename.sh
Last active December 27, 2022 10:14
Rename multiple files via mmv
# Simple change of file extension
mmv "*.ctp" "#1.php"
# Recursively renaming all `.ts` files to `.typoscript`
# ; matching subdirectories
# * matching the filename
mmv ";*.ts" "#1#2.typoscript"
@kitzberger
kitzberger / TCA.php
Last active January 30, 2022 06:29
TCA cheatsheet
<?php
$GLOBALS['TCA']['xxx']['columns']['xxx'] = [
// RTE: https://docs.typo3.org/m/typo3/reference-tca/10.4/en-us/ColumnsConfig/Type/textDefault.html
'config' => [
'type' => 'text',
'enableRichtext' => true,
'cols' => 40,
'rows' => 6,
'eval' => 'trim',
@kitzberger
kitzberger / MyCommand.php
Last active September 17, 2025 08:26
Typolink on CLI
<?php
namespace Me\MyExtension\Command;
use Symfony\Component\Console\Command\Command;
use TYPO3\CMS\Core\Core\SystemEnvironmentBuilder;
use TYPO3\CMS\Core\Http\ServerRequest;
use TYPO3\CMS\Core\Site\SiteFinder;
use TYPO3\CMS\Core\Utility\GeneralUtility;
@kitzberger
kitzberger / export-powermail-answers-as-csv.sh
Created June 3, 2021 07:16
Export answers to a powermail form via CLI as CSV
#!/bin/bash
PID="$1"
FILE="powermail-$PID.csv"
if [[ -z "$PID" ]]; then
echo "Please specify pid!";
exit;
fi
@kitzberger
kitzberger / warmup-cache.sh
Last active June 18, 2026 13:25
Simple warmup script
#!/bin/bash
URLS=(
https://www.example.net/
https://www.example.com/
)
DEPTH=5
ALLOWED_DOMAINS=www.example.net,www.example.com
EXCLUDE=typo3conf,fileadmin,typo3temp,uploads
@kitzberger
kitzberger / .bashrc
Last active February 18, 2021 13:25
PHP CS Fixer
function git-php-cs-fixer() {
files=$(git ls-files \*.php)
for file in $files
do
php-cs-fixer fix --rules=@PSR12 -- $file
done
}
@kitzberger
kitzberger / update.sql
Created November 9, 2020 20:00
Update SQL table with count of child elements
-- Updates tt_content.tx_mask_items with the number of child elements that refer to this record.
UPDATE tt_content parent
INNER JOIN (SELECT count(*) as count, tx_mask_items_parent FROM tt_content GROUP BY tx_mask_items_parent) children
ON children.tx_mask_items_parent = parent.uid AND parent.CType = 'mask_accordion'
SET parent.tx_mask_items=children.count
@kitzberger
kitzberger / Known Bugs.md
Last active January 6, 2025 19:07
Ubuntu (customizations)
@kitzberger
kitzberger / gist:a8304be3acf8994e84d1b7960e46c2a2
Last active October 26, 2020 14:30
TYPO3 PageTs Hack for gridelement backend layouts
--- a/typo3/sysext/backend/Classes/Form/FormDataProvider/PageTsConfigMerged.php 2020-10-26 14:41:48.000000000 +0100
+++ b/typo3/sysext/backend/Classes/Form/FormDataProvider/PageTsConfigMerged.php 2020-10-26 14:56:45.000000000 +0100
@@ -53,6 +53,21 @@
if (!empty($typeSpecificConfiguration[$type . '.']) && is_array($typeSpecificConfiguration[$type . '.'])) {
ArrayUtility::mergeRecursiveWithOverrule($newFieldConfiguration, $typeSpecificConfiguration[$type . '.']);
}
+ // hack for gridelements begins
+ if ($type === 'gridelements_pi1') {
+ if (!empty($fullFieldConfiguration['types.']['gridelements_pi1.']) &&
+ is_array($fullFieldConfiguration['types.']['gridelements_pi1.']) &&