Skip to content

Instantly share code, notes, and snippets.

View wsydney76's full-sized avatar
💭
Retired. Likely to respond slowly

Werner wsydney76

💭
Retired. Likely to respond slowly
  • Munich, Germany
View GitHub Profile
@wsydney76
wsydney76 / CollapseSidebarAsset.php
Last active February 29, 2024 19:28
Make sections of Craft 5 element indexes collapsible
<?php
namespace modules\main\web\assets\collapsesidebar;
use craft\web\AssetBundle;
/**
* Collapse Sidebar asset bundle
* Experimental!
*
@wsydney76
wsydney76 / MigrationController.php
Last active April 24, 2024 05:04
Craft CMS CLI command that helps to detect errors after migration to Craft 5 (renamed entry types etc.)
<?php
namespace modules\main\console\controllers;
use Craft;
use craft\console\Controller;
use craft\elements\Entry;
use craft\helpers\Console;
use GuzzleHttp\Exception\GuzzleException;
use yii\console\ExitCode;
@wsydney76
wsydney76 / MigrationController.php
Created March 19, 2024 18:17
Get fields in Craft CMS 5 with identical settings
<?php
// ....
public function actionConsolidateFieldsCandidates()
{
$signatures = [];
foreach (Craft::$app->getFields()->getAllFields() as $field) {
$signature = [
@wsydney76
wsydney76 / alpine-demo.twig
Last active October 25, 2024 10:04
Reference implemention in Alpine JS, what would that look like in Spark/DataStar???
<!DOCTYPE html>
<html lang="en-US">
<head>
<title>Alpine Demo</title>
<meta charset="utf-8"/>
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/full.min.css" rel="stylesheet" type="text/css"/>
{# {{ craft.vite.script("/resources/js/app.js", false) }} #}
<script src="https://cdn.tailwindcss.com?plugins=forms"></script>
<script defer src="https://cdn.jsdelivr.net/npm/@alpinejs/[email protected]/dist/cdn.min.js"></script>
@wsydney76
wsydney76 / ContentController.php
Created October 25, 2024 15:12
Instant Craft CMS instant search
<?php
namespace modules\main\controllers;
use craft\elements\Entry;
use craft\web\Controller;
use yii\web\Response;
/**
* Content controller