Skip to content

Instantly share code, notes, and snippets.

View Anubarak's full-sized avatar

Robin Schambach Anubarak

  • Secondred Newmedia GmbH
View GitHub Profile
$sectionHandle = 'character';
$entryTypeHandle = 'character';
$newEntryTypeHandle = 'newType3';
$newEntryTypeName = 'A new Type3';
/** @var Section $section */
$section = Craft::$app->getSections()->getSectionByHandle($sectionHandle);
$entryTypes = $section->getEntryTypes();
$entryType = ArrayHelper::filterByValue($entryTypes, 'handle', $entryTypeHandle);
{% set events = craft.entries()
.section('events')
.andWhere('DATE(CONVERT_TZ(field_eventStartDate, "UTC", "Europe/Berlin")) >= ' ~ 'now'|date('Ymd'))
.all() %}
(function ($) {
if (!window.Craft || !window.jQuery || typeof Craft === 'undefined') {
return false;
}
Craft.MatrixColorization = Garnish.Base.extend({
settings: {
colors: [
'#A7CECB', '#90ACAF', '#AAA998', '#D4D698', '#F4EBBE'
class Project_Twig_Extension extends Twig_Extension implements Twig_Extension_GlobalsInterface
{
public function getGlobals()
{
return array(
'craft' => new \craft\web\twig\variables\CraftVariable(),
'entry' => new \craft\elements\Entry(),
'asset' => new \craft\elements\Asset(),
'category' => new \craft\elements\Category(),
'currentUser' => new \craft\elements\User(),