Skip to content

Instantly share code, notes, and snippets.

View jackrabbithanna's full-sized avatar

Mark Hanna jackrabbithanna

View GitHub Profile
@jackrabbithanna
jackrabbithanna / gist:72952c7507a248ef78be8ee15e2775bb
Created March 23, 2021 18:47
Sample Proximity + Leaflet map View config
langcode: en
status: true
dependencies:
module:
- civicrm_entity
- civicrm_entity_leaflet
- options
id: proximity_with_map
label: 'Proximity with Map'
module: views
@jackrabbithanna
jackrabbithanna / gist:088562f90731d11aac25272602108424
Created March 23, 2021 18:39
Example View with proximity filter
langcode: en
status: true
dependencies:
module:
- civicrm_entity
- options
id: proximity
label: Proximity
module: views
description: ''
uuid: 88453c8e-978b-4a73-81a2-e124007c01a7
langcode: en
status: true
dependencies:
module:
- civicrm_entity
- user
id: contact_related_perm_test
label: 'Contact related Perm test'
module: views
@jackrabbithanna
jackrabbithanna / civicrm_customs.module
Last active May 10, 2022 23:07
Custom activity status update VBO .module file
function civicrm_customs_action_info() {
return array(
'civicrm_customs_update_activity_status_action' => array(
'type' => 'civicrm_activity',
'label' => t('Update Activity Status'),
'behavior' => array('views_property'),
'configurable' => FALSE,
'vbo_configurable' => TRUE,
'triggers' => array('any'),
'pass rows' => TRUE,
@jackrabbithanna
jackrabbithanna / gist:295ee250ea702f2bd18c62dc587bfd4d
Created November 7, 2020 01:56
civicrm_customs.module -- D7 Custom VBO action to update participant status
function civicrm_customs_action_info() {
return array(
'civicrm_customs_update_participant_status_action' => array(
'type' => 'civicrm_participant',
'label' => t('Update participant status'),
'behavior' => array('views_property'),
'configurable' => FALSE,
'vbo_configurable' => TRUE,
'triggers' => array('any'),
'pass rows' => TRUE,
<?php
use Drupal\Tests\civicrm_tests\FunctionalJavascript\CivicrmFunctionalJavascriptBase;
/**
* Class CivicrmExtensionTests
*
* @group CivicrmTests
*/
class CivicrmExtensionTests extends CivicrmFunctionalJavascriptBase {
<?php
namespace Drupal\Tests\civicrm_tests\FunctionalJavascript;
use Behat\Mink\Element\NodeElement;
use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
use Drupal\Core\Database\Database;
/**
* Base class for CiviCRM Functional Javascript Tests
@jackrabbithanna
jackrabbithanna / gist:94d2f6cf222a01a657200d01b96882c8
Created April 28, 2020 13:52
Contact -> User, User -> Contact hook_views_data_alter()
$data['civicrm_contact']['user'] = [
'title' => 'User related to the CiviCRM contact',
'help' => 'Relate user to the CiviCRM contact.',
'relationship' => [
'base' => 'users_field_data',
'base field' => 'uid',
'first field' => 'contact_id',
'second field' => 'uf_id',
'id' => 'civicrm_entity_civicrm_contact_user',
'label' => 'User',
@jackrabbithanna
jackrabbithanna / gist:a6c31b91dd9df2e79090b08590a860a4
Created April 28, 2020 13:49
D8 Contact -> User, User-> Contact View relationship plugin src/Plugin/views/relationship/CiviCrmContactUser.php
<?php
namespace Drupal\civicrm_entity\Plugin\views\relationship;
use Drupal\views\Plugin\views\relationship\RelationshipPluginBase;
use Drupal\views\Views;
/**
* Relationship for referencing civicrm_contact and user.
*
class LmsLrsTestCaseSelenium extends \PHPUnit_Extensions_Selenium2TestCase {
/**
* Standard phpunit setup method.
*/
public function setUp() {
global $bootstrap;
if (!empty($bootstrap)) {
$this->bootstrap = $bootstrap;