Skip to content

Instantly share code, notes, and snippets.

@dergachev
Created November 18, 2015 19:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dergachev/3f089b8838ae3c0bc216 to your computer and use it in GitHub Desktop.
Save dergachev/3f089b8838ae3c0bc216 to your computer and use it in GitHub Desktop.
<?php
/**
* @file
* lf_hellosign.features.inc
*/
/**
* Implements hook_ctools_plugin_api().
*/
function lf_hellosign_ctools_plugin_api($module = NULL, $api = NULL) {
if ($module == "strongarm" && $api == "strongarm") {
return array("version" => "1");
}
}
name = LF HelloSign
description = Manages integration between the LF Identity site and the HelloSign API.
core = 7.x
package = Linux Foundation
dependencies[] = ctools
dependencies[] = hellosign
dependencies[] = strongarm
features[ctools][] = strongarm:strongarm:1
features[features_api][] = api:2
features[variable][] = hellosign_use_text_tags
<?php
/**
* @file
* Code for the LF HelloSign feature.
*/
include_once 'lf_hellosign.features.inc';
/**
* Generates a HelloSign signature request.
*
* @see hellosign_generate_og_esignature_request()
*/
function lf_hellosign_generate_esignature_request($title, $subject, $signers, $file) {
// For testing purposes, allow this function to return a mock result without
// contacting the HelloSign API.
if (variable_get('lf_hellosign_test_without_api', FALSE)) {
return array(
'status' => 1,
'signature_request_id' => NULL,
);
}
return hellosign_generate_esignature_request($title, $subject, $signers, $file);
}
/**
* Implements hook_process_hellosign_callback().
*/
function lf_hellosign_process_hellosign_callback($data) {
// Handle signature request error conditions from the HelloSign API. See
// https://www.hellosign.com/api/reference#EventNames.
if (in_array($data->event->event_type, array('file_error', 'unknown_error', 'signature_request_invalid'))) {
watchdog('lf_hellosign', 'Hellosign error of type "@type" received: <pre>@data</pre>', array('@type' => $data->event->event_type, '@data' => print_r($data, TRUE)), WATCHDOG_ERROR);
}
}
<?php
/**
* @file
* lf_hellosign.strongarm.inc
*/
/**
* Implements hook_strongarm().
*/
function lf_hellosign_strongarm() {
$export = array();
$strongarm = new stdClass();
$strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */
$strongarm->api_version = 1;
$strongarm->name = 'hellosign_use_text_tags';
$strongarm->value = TRUE;
$export['hellosign_use_text_tags'] = $strongarm;
return $export;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment