Skip to content

Instantly share code, notes, and snippets.

View jackrabbithanna's full-sized avatar

Mark Hanna jackrabbithanna

View GitHub Profile
@jackrabbithanna
jackrabbithanna / gist:71e407d5ffb089b4a07778b47a5629b8
Last active January 24, 2017 03:24
Custom FAPI multivalued element type, 2 column grid of textfields, ajax add and remove
/**
* Implements hook_theme().
*
* @return array
*/
function webform_multi_theme() {
return array(
'webform_multi_url_params_field' => array(
'render element' => 'element',
),
@jackrabbithanna
jackrabbithanna / gist:170a3537adc06238d0ee9e74027727ae
Created May 25, 2017 19:11
Views export for contribution page view, with price set entity and price set relationships
$view = new view();
$view->name = 'contribution_pages';
$view->description = '';
$view->tag = 'default';
$view->base_table = 'civicrm_contribution_page';
$view->human_name = 'Contribution Pages';
$view->core = 7;
$view->api_version = '3.0';
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
class LmsLrsTestCaseSelenium extends \PHPUnit_Extensions_Selenium2TestCase {
/**
* Standard phpunit setup method.
*/
public function setUp() {
global $bootstrap;
if (!empty($bootstrap)) {
$this->bootstrap = $bootstrap;
pcp_views_handlers.info:
name = PCP Views Field Handlers -- Additional
description = Adds some CiviCRM PCP Views handlers
core = 7.x
package = Custom
version = "7.x-1.0"
dependencies[] = civicrm
dependencies[] = views
@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.
*
@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',
<?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
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 / 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: ''