Skip to content

Instantly share code, notes, and snippets.

View h3nn3s's full-sized avatar

Henrik Ziegenhain h3nn3s

View GitHub Profile
<?php
namespace MyVendor\MyPackage\Service;
use TYPO3\CMS\Core\Core\Environment;
use TYPO3\CMS\Core\Database\ConnectionPool;
use TYPO3\CMS\Core\Utility\GeneralUtility;
/**
* Use in ext_localconf.php with ExtensionManagementUtility::addTypoScript()
@peterkraume
peterkraume / import-production-data
Created January 9, 2020 11:00
DDEV custom command for .ddev/commands/host
#!/bin/bash
## Description: Fetch and import production data
## Usage: import-production-data
## Example: "ddev import-production-data"
SSH_CREDENTIALS="[email protected]"
PRODUCTION_DB_USER="user"
PRODUCTION_DB_PASSWORD="pw"
@zeraphie
zeraphie / !-readme.md
Last active October 16, 2019 11:56
Add a service worker that can read a sitemap

Service Workers with a Sitemap Parser

This is a collection of ES2017 classes (so a transpiler is needed, webpack is used here with babel and the env preset) that utilize Service Workers to add offline support for a site. This example should work for WordPress sites as well

Installation

Because DOMParser is not included in Service Workers, you will need to install the npm package xmldom

npm install xmldom --save-dev

With Service Workers

@einpraegsam
einpraegsam / datamappingExtbase.php
Last active November 3, 2023 16:15
Use DataMapper class in TYPO3 to convert an array into an object
public function mapProperties(): AnyModel
{
$properties = [
'uid' => 123,
'pid' => 123,
'firstname' => 'Alex',
'lastname' => 'Kellner'
'email' => '[email protected]'
];
$dataMapper = $this->objectManager->get(TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapper::class);
@ju1
ju1 / cookieConsentGTMRecipe.json
Created May 5, 2017 20:34
Cookie Consent Notification - GTM Recipe
{
"exportFormatVersion": 2,
"exportTime": "2017-05-05 20:33:04",
"containerVersion": {
"path": "accounts/1164259306/containers/6851003/versions/0",
"accountId": "1164259306",
"containerId": "6851003",
"containerVersionId": "0",
"container": {
"path": "accounts/1164259306/containers/6851003",
@mschwemer
mschwemer / TtContent.php
Last active February 16, 2018 13:58
Domain model for tt_content to be used in content element element relations
<?php
namespace MyNameSpace\Myextension\Domain\Model;
/**
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
@fazzyx
fazzyx / ReferenceViewHelper.php
Last active November 7, 2016 14:16
TYPO3 Fluid ViewHelper for content element "shortcut"
<?php
namespace NAMESPACE\ThemeMgCustom\ViewHelpers;
/*
*
* Copyright notice
*
* (c) 2015 Claus Fassing <[email protected]>, MEDIENGARAGE
*
* All rights reserved
@smichaelsen
smichaelsen / gitlab_typo3_setup.md
Last active August 12, 2022 14:11
Setting up a Build Server for TYPO3 projects on Gitlab.com

Setting up a Build Server for TYPO3 projects on Gitlab.com

Background

We're a small team of only two people, but we're tackling more and more rather big TYPO3 projects. Over time we introduced package management for PHP (composer) and JS (bower) and depended on frontend building with Grunt. With rising complexity and importance of our projects we felt the demand for an efficient and safe way to deploy our websites on different servers.

We helped our selves with small self written deploy scripts that performed building on the target server, but you can't run node (for Grunt) or sass in every environment, and if building goes wrong the website was likely to be broken on the live server - so we needed a Build Server.

But solutions we looked at turned out to be quite time consuming (setting up and managing self hosted Gitlab and Gitlab-CI or a Jenkins server and runners) or costly.

Free Hosting on Gitlab.com

@ahoffmeyer
ahoffmeyer / Modal.js
Last active March 30, 2016 14:47
TYPO3 Modalbox with single content or full page selection using jQuery
(function(window, document, $) {
"use strict"
// Just for testing purposes this function triggers on all links
$('a').on('click', function(event) {
event.preventDefault();
// remove all existing modalboxes in DOM
@oliverthiele
oliverthiele / robots.txt
Last active November 23, 2023 18:18
robots.txt for TYPO3
User-agent: *
# Only allow URLs generated with RealURL
Disallow: /*?id=*
Disallow: /*&id=*
# L=0 is the default language
Disallow: /*?L=0*
Disallow: /*&L=0*