Skip to content

Instantly share code, notes, and snippets.

View sebkln's full-sized avatar
💭
I may be slow to respond.

Sebastian Klein sebkln

💭
I may be slow to respond.
View GitHub Profile
@sebkln
sebkln / SrcsetImage.html
Last active August 1, 2022 05:46
TYPO3 Fluid sourceset image partial
<html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers" data-namespace-typo3-fluid="true">
<f:comment>
<!--
Below: Compare the column size with the actual image size.
This allows the editor to set a maxWidth in the Content Element.
The 'sizes' attribute will prevent upscaling to 100vw of smaller images.
Please keep in mind:
- Only srcset values for images greater than this calculated width are generated!
@sebkln
sebkln / Custom.yaml
Last active June 19, 2018 20:17
Custom CKEditor configuration including linebreak plugin
# Load default processing options
imports:
- { resource: "EXT:rte_ckeditor/Configuration/RTE/Processing.yaml" }
- { resource: "EXT:rte_ckeditor/Configuration/RTE/Editor/Base.yaml" }
- { resource: "EXT:rte_ckeditor/Configuration/RTE/Editor/Plugins.yaml" }
# Add configuration for the editor
# For complete documentation see http://docs.ckeditor.com/#!/api/CKEDITOR.config
editor:
externalPlugins:
@sebkln
sebkln / PrefillFormWithCurrentPageHook.php
Created March 27, 2023 07:54
TYPO3 Form Framework: Use hook to prefill hidden form field with current page title and UID
<?php
namespace Sebkln\FormExamples\Hooks;
use TYPO3\CMS\Form\Domain\Model\Renderable\RootRenderableInterface;
use TYPO3\CMS\Form\Domain\Runtime\FormRuntime;
class PrefillFormWithCurrentPageHook {
/**
* @param FormRuntime $formRuntime
@sebkln
sebkln / Custom.yaml
Created January 6, 2024 14:29
TYPO3 v12+, CKEditor 5: simple plugin that allows to <div> elements as wrappers around paragraphs. Not yet editor-friendly, though.
# CKEditor 5 configuration in TYPO3 (excerpt)
imports:
- { resource: 'EXT:rte_ckeditor/Configuration/RTE/Processing.yaml' }
- { resource: 'EXT:rte_ckeditor/Configuration/RTE/Editor/Base.yaml' }
- { resource: 'EXT:rte_ckeditor/Configuration/RTE/Editor/Plugins.yaml' }
editor:
config:
importModules:
- '@yourvendor/ckeditor-div'
@sebkln
sebkln / RequestMiddlewares.php
Created January 6, 2024 15:48
Middleware for web manifest in TYPO3 v12. Adjusted version of the solution provided by Kevin Appelt in TYPO3 Slack: https://typo3.slack.com/archives/C025BQLFA/p1680299950579649
<?php
return [
'frontend' => [
'yourvendor/webmanifest' => [
'target' => \YourVendor\Sitepackage\Middleware\Webmanifest::class,
'before' => [
'typo3/cms-frontend/page-resolver',
],
'after' => [