Skip to content

Instantly share code, notes, and snippets.

@wsydney76
wsydney76 / ACTIONS.md
Last active March 18, 2025 13:23
ACTIONS: Library functions for calling Craft CMS controllers from JavaScript

How to Use the Craft CMS Actions Twig Component

This documentation explains how to use the @extras/_actions.twig component in Craft CMS to call web controller actions via JavaScript and display success or error notices.


Component Overview

The Actions component allows you to make asynchronous requests to Craft CMS web controller actions and handle responses within your JavaScript code. Additionally, the component can display success or error notifications to users based on the outcome of the requests.

@danhollick
danhollick / tailwind-css-v4.mdc
Last active May 12, 2025 13:24
Cursor rules file for Tailwind CSS v4.0
// Update globs depending on your framework
---
name: tailwind_v4
description: Guide for using Tailwind CSS v4 instead of v3.x
globs: ["**/*.{js,ts,jsx,tsx,mdx,css}"]
tags:
- tailwind
- css
---
@mike-moreau
mike-moreau / ckeditor-field-config.json
Last active January 13, 2025 23:22
Baseline Craft 5 CKEditor Field JSON Config
{
"htmlSupport": {
"allow": [
{
"attributes": true,
"classes": [
"button",
"button-primary"
],
"name": "a"
@khalwat
khalwat / m240515_172552_add_index_to_demo_data.php
Last active February 4, 2025 20:38
Craft CMS 5 content migration that will create a functional index for custom fields, which are now stored as a JSON column in element_sites.content. Also handles dropping the index if the migration is reverted.
<?php
/**
* Craft CMS 5 content migration that will create a functional index for custom fields, which
* are now stored as a JSON column in element_sites.content. Also handles dropping the index if
* the migration is reverted.
*
* @licence MIT
* @link https://nystudio107.com
* @copyright Copyright (c) nystudio107
*/
@khalwat
khalwat / m240430_143914_seed_db_data.php
Last active April 16, 2025 14:05
Craft CMS 5 content migration that creates & deletes Fields, EntryTypes & Sections, adds the Fields to the EntryTypes, adds the EntryTypes to the Sections, and then seeds the newly created Section with faked data. Also has a `safeDown()` method to revert what the migration adds
<?php
/**
* Craft CMS 5 content migration that creates & deletes Fields, EntryTypes & Sections, adds the Fields to the
* EntryTypes, adds the EntryTypes to the Sections, and then seeds the newly created Section with faked data.
* Also has a `safeDown()` method to revert what the migration adds
*
* @licence MIT
* @link https://nystudio107.com
* @copyright Copyright (c) nystudio107
*/