Skip to content

Instantly share code, notes, and snippets.

View mccrodp's full-sized avatar

Paul McCrodden mccrodp

View GitHub Profile
@mccrodp
mccrodp / domlistener.js
Created June 2, 2017 06:49
DOM Mutation Listener - Google Maps
var observeDOM = (function(){
var MutationObserver = window.MutationObserver || window.WebKitMutationObserver,
eventListenerSupported = window.addEventListener;
return function(obj, callback){
if( MutationObserver ){
// define a new observer
var obs = new MutationObserver(function(mutations, observer){
if( mutations[0].addedNodes.length || mutations[0].removedNodes.length )
callback();
@mccrodp
mccrodp / Nav.elm
Created May 17, 2017 03:53
Elm Bootstrap Navbar menu for Bell Template
navigation : Model -> Html Msg
navigation model =
Navbar.config NavbarMsg
|> Navbar.lightCustomClass "navbar-inverse"
|> Navbar.withAnimation
|> Navbar.collapseSmall
|> Navbar.container
|> Navbar.brand [ href "/" ] [
img [ alt "", src "img/logo-nav.png" ][]
]
<script type="text/javascript" src="plugins/sticky.js"></script>
<script type="text/javascript">
var nav=document.querySelectorAll('#nav')
Array.prototype.forEach.call(nav, function(nav) {
sticky(nav);
});
</script>
@mccrodp
mccrodp / message.html.twig
Created January 22, 2016 15:39
Message Template Output
Drupal\Core\Render\Markup Object
(
[string:protected] =>
<!-- THEME DEBUG -->
<!-- THEME HOOK: 'message' -->
<!-- FILE NAME SUGGESTIONS:
* message--2--full.html.twig
* message--2.html.twig
* message--example-create-node--full.html.twig
@mccrodp
mccrodp / message-text-process-markup-pass1.patch
Created November 17, 2015 08:56
Message text : Process markup - Pass 1
diff --git a/src/Entity/Message.php b/src/Entity/Message.php
index e000146..e9b322f 100644
--- a/src/Entity/Message.php
+++ b/src/Entity/Message.php
@@ -317,9 +317,9 @@ class Message extends ContentEntityBase implements MessageInterface {
$output = strtr($output, $args);
}
- $output = \Drupal::token()->replace($output, array('message' => $this), $options);
+ $element['#markup'] = \Drupal::token()->replace($output, array('message' => $this), $options);
@mccrodp
mccrodp / message-d8-remove-deprecated-methods.patch
Created November 16, 2015 11:52
Start removing deprecated methods for Message for D8
diff --git a/message.api.php b/message.api.php
index 0f62a1a..4e9366f 100644
--- a/message.api.php
+++ b/message.api.php
@@ -6,6 +6,8 @@
*
*/
+use Drupal\message\Entity\MessageType;
+