Skip to content

Instantly share code, notes, and snippets.

View colemanw's full-sized avatar
🎯
Focusing

colemanw

🎯
Focusing
View GitHub Profile
@colemanw
colemanw / gist:2306860feaae1bf8502542f33488176f
Created July 23, 2026 17:27
Script to add `nofilter` to html smarty blocks
#!/usr/bin/env php
<?php
/**
* Recursively updates *.tpl files to add 'nofilter' to any {ts} block containing markup.
*
* Usage:
* php add_nofilter.php /path/to/directory
*/
<?php
namespace Civi\Mixin\EntityTypesXmlV1;
class Loader {
private \CRM_Extension_MixInfo $mixInfo;
public function __construct(\CRM_Extension_MixInfo $mixInfo) {
$this->mixInfo = $mixInfo;
<?php
use Civi\Api4\Contribution;
@colemanw
colemanw / cowModule.js
Last active July 19, 2021 17:15
Traits for AngularJS controllers
angular.module('cowModule').factory('cowTrait', function() {
// Private function (not available to controller using this trait)
function getSound() {
return 'Moo';
}
// Public properties & methods for use as a trait
return {
cows: 0,
<?php
/**
* Trait mixed into BAOs who support bulk-save operations
*/
trait CRM_Core_BulkSaveTrait {
/**
* @param $params
* @return CRM_Core_DAO|NULL
@colemanw
colemanw / webform_civicrm.utils.diff
Last active February 21, 2019 17:19
Add tag fields for multiple entities
diff --git a/includes/utils.inc b/includes/utils.inc
index dc502c5..97757dc 100644
--- a/includes/utils.inc
+++ b/includes/utils.inc
@@ -806,16 +806,6 @@ function wf_crm_get_fields($var = 'fields') {
'table' => 'group',
'expose_list' => TRUE,
);
- $tagsets = array('' => t('Tag(s)')) + CRM_Core_BAO_Tag::getTagSet('civicrm_contact');
- foreach ($tagsets as $pid => $name) {
@colemanw
colemanw / font-awesome-mime-type-icons.php
Last active June 5, 2025 19:55 — forked from gdressel/font-awesome-mime-type-icons.php
Font Awesome File Icons: Mapping MIME Types to correct icon classes
<?php
/**
* Get font awesome file icon class for specific MIME Type
* @see https://gist.github.com/guedressel/0daa170c0fde65ce5551
*
*/
function ($mime_type) {
// List of official MIME Types: http://www.iana.org/assignments/media-types/media-types.xhtml
$icon_classes = array(
@colemanw
colemanw / gitpr
Last active October 14, 2016 13:10
GitPR script
#!/bin/bash
# start at top directory if we're not already there
pushd "$(git rev-parse --show-toplevel)" > /dev/null
# run style checker
civilint
if [[ $? == 1 ]]
then
echo "PR aborted"
diff --git a/CRM/Core/BAO/Note.php b/CRM/Core/BAO/Note.php
index ef7dff8..da06824 100644
--- a/CRM/Core/BAO/Note.php
+++ b/CRM/Core/BAO/Note.php
@@ -574,4 +574,19 @@ WHERE participant.contact_id = %1 AND note.entity_table = 'civicr
m_participant'
}
}
+ /**
diff --git a/CRM/Core/CodeGen/Specification.php b/CRM/Core/CodeGen/Specification.php
index 86c211a..a6f417b 100644
--- a/CRM/Core/CodeGen/Specification.php
+++ b/CRM/Core/CodeGen/Specification.php
@@ -416,6 +416,8 @@ class CRM_Core_CodeGen_Specification {
'callback',
// Path to options edit form
'optionEditPath',
+ // A simple list of options. I miss enum fields...
+ 'options',