Skip to content

Instantly share code, notes, and snippets.

View kitzberger's full-sized avatar

Philipp Kitzberger kitzberger

View GitHub Profile
@kitzberger
kitzberger / TYPO3-Redirects.md
Created June 13, 2024 07:00
Debugging TYPO3 Redirects
$GLOBALS['TYPO3_CONF_VARS']['LOG']['TYPO3']['CMS']['Redirects'] => [
   'Service' => [
       'RedirectService' => [
           'writerConfiguration' => [
               \TYPO3\CMS\Core\Log\LogLevel::DEBUG => [
                   \TYPO3\CMS\Core\Log\Writer\FileWriter::class => [
                       'logFileInfix' => 'core-redirect-service'
                   ],
],
@kitzberger
kitzberger / setup.typoscript
Last active May 29, 2024 13:04
TYPO3: clever HMENU browse next/prev
# This menu is considered to be 'clever' due to the fact that it's sliding accross the entire page tree:
#
# * Previous link: if there's no previous sibling page, we're linking to the parent page instead
# * Next link:
# * if there's no child page, we're linking to the next sibling page
# * if that's not available, we're linking to the next sibling page of the parent page
# * if that's not available, we're linking to the next sibling page of the grandparent page
temp.browseMenuItem = HMENU
temp.browseMenuItem.special = browse
@kitzberger
kitzberger / sed examples.md
Created March 14, 2024 08:02
Useful sed commands

Duplicate a line and modify it

sed '/pattern/{p;s/pattern/replacement/}' input_file

Explanation:

  • /pattern/: This specifies the pattern that identifies the line you want to duplicate and modify.
  • {p;s/pattern/replacement/}: This is a group of commands enclosed within {}.
@kitzberger
kitzberger / Form.yaml
Created March 2, 2024 08:41
TYPO3 EXT:form field with label override per finisher
renderables:
-
type: Page
identifier: page
label: Form
renderables:
-
defaultValue: ''
type: Text
identifier: name
@kitzberger
kitzberger / MyClass.php
Created August 1, 2023 07:45
TYPO3 Timetracker
<?php
$tt = GeneralUtility::makeInstance(\TYPO3\CMS\Core\TimeTracker\TimeTracker::class);
$tt->start();
// Expensive operation here
$tt->finish();
// Print the runtime between start and finish in milliseconds.
@kitzberger
kitzberger / PageModuleHook.php
Created June 27, 2023 13:14
TYPO3 PageModule Enhancements
<?php
namespace My\Extension\Hooks;
use TYPO3\CMS\Backend\Controller\PageLayoutController;
use TYPO3\CMS\Backend\View\BackendLayoutView;
use TYPO3\CMS\Core\Utility\GeneralUtility;
class PageModuleHook
{
@kitzberger
kitzberger / RTE.css
Last active November 17, 2023 17:21
CKeditor: breitere Dropdowns
/* This modifies the outer part of the CKeditor */
.cke_combo__styles .cke_combo_text { width: 150px; }
.cke_combo__format .cke_combo_text { width: 150px; }
.cke_combopanel { width: 150px !important; }
@kitzberger
kitzberger / Fluid.html
Created June 6, 2023 20:52
Tips for fluid templating
Berechnung und Zuweisung zu neuer Variable:
✗ {imageWidth / 2.24 -> f:variable(name: 'imageHeight')}
✓ {f:variable(name:'imageHeight', value:'{imageWidth / 2.71}')}
Casting
✗ {imageHeight as integer -> f:variable(name:'imageHeight')}
✓ {f:variable(name:'imageHeight',value:'{imageHeight as integer}')}
@kitzberger
kitzberger / .bashrc
Created May 10, 2023 10:57
Script for bumping versions in TYPO3 projects
t3version() {
[[ -z "$1" ]] && echo "Specify new version parameter!" && return
extEmconf=$(git ls-files *ext_emconf.php)
if [ ! -z "$extEmconf" ]; then
sed -i "s/'version'\(\s*\)=>\(\s*\)'\(.*\)',/'version'\1=>\2'$1',/" $extEmconf
git add $extEmconf
echo "Updated version in all ext_emconf.php's"
fi
packageJson=$(git ls-files *package.json)
if [ ! -z "$packageJson" ]; then
@kitzberger
kitzberger / ActionController.php
Created April 12, 2023 16:12
Content element in extbase controller
<?php
public function myAction()
{
$contentElement = $this->configurationManager->getContentObject()->data;
$this->view->assign('record', $contentElement);
}