Skip to content

Instantly share code, notes, and snippets.

View mickadoo's full-sized avatar
💭
Making bugs

Michael Devery mickadoo

💭
Making bugs
  • Ireland
View GitHub Profile
@mickadoo
mickadoo / template-variables.md
Last active May 14, 2018 15:37
Options for having global template variables

Write a smarty modifier to check permission

✔️ flexible solution that can be used for any future permission
❌ the modifier format is confusing, most people would probably expect a function call instead

{if 'access CiviCRM'|permissionCheck }
  <!-- Do something -->
{/if}
@mickadoo
mickadoo / upgrader_spec.md
Created June 21, 2018 15:11
Upgraders Spec
function upgrade_174() {
  $this->runAllClassesInDirectory('Upgrade_174');
}
class Upgrade_174_SetDrupalVariable implements UpgraderInterface {
 
 public function upgrade() {

Overview

compudeploy creates, deploys and updates CiviCRM websites

Requirements

  • The creation command should take a single repository URL
  • The host for the site should be flexible: local host, local vagrant, local docker, remote host, AWS
  • The type of site should be flexible: a profile or a "full site" repository
@mickadoo
mickadoo / webform_logging.php
Created August 29, 2018 13:02
Overview of how to log webform
<?php
// Inside civihr_employee_portal.module..
// this will enable logging before data is saved
function civihr_employee_portal_webform_submission_presave($node, &$submission) {
// todo restrict to certain nodes
$logger = Civi::container()->get(ApiChangelogWrapper::class);
$logger->setIsActive(TRUE);
}
@mickadoo
mickadoo / Upgrader.php
Last active October 15, 2018 10:10
Upgrader methods for implementing upgrader steps as classes
<?php
class CRM_MyExtension_Upgrader extends CRM_MyExtension_Upgrader_Base {
/**
* @inheritdoc
*/
public function hasPendingRevisions() {
$revisions = $this->getRevisions();
$currentRevisionNum = $this->getCurrentRevision();