Skip to content

Instantly share code, notes, and snippets.

@ahebrank
ahebrank / HobsonsConnect.php
Last active March 14, 2017 15:32
PHP mini API for connecting to Hobsons CRM
<?php
// some of this functionality is borrowed from another API found on Github that unfortunately contains private credentials
// hopefully this will have better SEO: Hobsons, HobsonsConnect, SOAP, WDSL
class HobsonsConnect {
var $client, $params;
function __construct($clientname, $passkey) {
$bridge_url = 'https://' . $clientname . '.askadmissions.net/ws/bridge.asmx?wsdl';
$this->client = new SoapClient($bridge_url, array('trace' => 1));
@ahebrank
ahebrank / kint_limit_max_levels.patch
Created March 15, 2017 16:45
Devel Kint patch to limit array/object descent levels
diff --git a/kint/kint/config.default.php b/kint/kint/config.default.php
index 72f0a69..d75bb42 100644
--- a/kint/kint/config.default.php
+++ b/kint/kint/config.default.php
@@ -75,7 +75,7 @@
/** @var int max array/object levels to go deep, if zero no limits are applied */
-$_kintSettings['maxLevels'] = 7;
+$_kintSettings['maxLevels'] = 4;
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
diff --git a/src/Plugin/views/style/FullCalendar.php b/src/Plugin/views/style/FullCalendar.php
index afd1bc4..fcc45e5 100644
--- a/src/Plugin/views/style/FullCalendar.php
+++ b/src/Plugin/views/style/FullCalendar.php
@@ -279,6 +279,19 @@ class FullCalendar extends StylePluginBase {
return $settings;
}
+ /**
+ * Reset a date to UTC
@ahebrank
ahebrank / views_ajax_enabled_check.patch
Last active August 25, 2017 14:38
8.3.7 Views ajax access API bugfix
diff --git a/core/modules/views/src/Controller/ViewAjaxController.php b/core/modules/views/src/Controller/ViewAjaxController.php
index d204766..2e0ea18 100644
--- a/core/modules/views/src/Controller/ViewAjaxController.php
+++ b/core/modules/views/src/Controller/ViewAjaxController.php
@@ -142,7 +142,7 @@ public function ajaxView(Request $request) {
throw new NotFoundHttpException();
}
$view = $this->executableFactory->get($entity);
- if ($view && $view->access($display_id) && $view->setDisplay($display_id) && $view->display_handler->getOption('use_ajax')) {
+ if ($view && $view->access($display_id) && $view->setDisplay($display_id) && $view->display_handler->ajaxEnabled()) {
diff --git a/content_moderation_notifications.services.yml b/content_moderation_notifications.services.yml
index 5b2d342..2a6b525 100644
--- a/content_moderation_notifications.services.yml
+++ b/content_moderation_notifications.services.yml
@@ -4,4 +4,4 @@ services:
arguments: ['@entity_type.manager', '@content_moderation.moderation_information']
content_moderation_notifications.notification:
class: Drupal\content_moderation_notifications\Notification
- arguments: ['@plugin.manager.mail']
+ arguments: ['@plugin.manager.mail', '@?token.entity_mapper']
@ahebrank
ahebrank / invalid_attribute_xdebug_break.patch
Created September 20, 2017 15:06
xdebug break for core element.php invalid attribute
diff --git a/core/lib/Drupal/Core/Render/Element.php b/core/lib/Drupal/Core/Render/Element.php
index e394a39..32755f2 100644
--- a/core/lib/Drupal/Core/Render/Element.php
+++ b/core/lib/Drupal/Core/Render/Element.php
@@ -94,6 +94,7 @@ public static function children(array &$elements, $sort = FALSE) {
// Only trigger an error if the value is not null.
// @see https://www.drupal.org/node/1283892
elseif (isset($value)) {
+ xdebug_break();
trigger_error(SafeMarkup::format('"@key" is an invalid render array key', ['@key' => $key]), E_USER_ERROR);
diff --git a/src/Plugin/Field/FieldFormatter/MenuReferenceFormatter.php b/src/Plugin/Field/FieldFormatter/MenuReferenceFormatter.php
index 3f46dbd..fad4a91 100644
--- a/src/Plugin/Field/FieldFormatter/MenuReferenceFormatter.php
+++ b/src/Plugin/Field/FieldFormatter/MenuReferenceFormatter.php
@@ -4,6 +4,7 @@ namespace Drupal\menu_reference_render\Plugin\Field\FieldFormatter;
use Drupal\Core\Field\FieldItemListInterface;
use Drupal\Core\Field\Plugin\Field\FieldFormatter\EntityReferenceFormatterBase;
+use Drupal\Core\Field\FieldDefinitionInterface;
os=$(dpkg --print-architecture)
if [ "$os" = "armhf" ]; then os=arm; fi
url="http://www.mysqueezebox.com/update/?version=7.9.1&revision=1&geturl=1&os=deb$os"
latest_lms=$(wget -q -O - "$url")
mkdir -p /sources
cd /sources
wget $latest_lms
lms_deb=${latest_lms##*/}
dpkg -i $lms_deb
@ahebrank
ahebrank / pantheon-solr-local-docker.patch
Last active October 17, 2017 13:44
Pantheon solr patch
diff --git a/src/Plugin/SolrConnector/PantheonSolrConnector.php b/src/Plugin/SolrConnector/PantheonSolrConnector.php
index e4702b8..fd45a30 100644
--- a/src/Plugin/SolrConnector/PantheonSolrConnector.php
+++ b/src/Plugin/SolrConnector/PantheonSolrConnector.php
@@ -71,6 +71,14 @@ class PantheonSolrConnector extends StandardSolrConnector {
'path' => '/sites/self/environments/' . $_ENV['PANTHEON_ENVIRONMENT'] . '/index',
];
}
+ else {
+ $pantheon_specific_configuration = [