Skip to content

Instantly share code, notes, and snippets.

@tedbow
tedbow / json-api--node.json
Created April 19, 2018 13:27
/json/node result
{
"data": [
{
"type": "node--article",
"id": "799bf41c-5f5d-403f-8c51-b929dd649794",
"attributes": {
"nid": 1,
"uuid": "799bf41c-5f5d-403f-8c51-b929dd649794",
"vid": 1,
"langcode": "en",
diff --git a/core/modules/field_layout/field_layout.layouts.yml b/core/modules/field_layout/field_layout.layouts.yml
index 0aaa87b..ed30a94 100644
--- a/core/modules/field_layout/field_layout.layouts.yml
+++ b/core/modules/field_layout/field_layout.layouts.yml
@@ -19,3 +19,18 @@ twocol:
label: Left
right:
label: Right
+
+threecol:
diff --git a/core/modules/outside_in/js/offcanvas.js b/core/modules/outside_in/js/offcanvas.js
index b3c4237..9522f03 100644
--- a/core/modules/outside_in/js/offcanvas.js
+++ b/core/modules/outside_in/js/offcanvas.js
@@ -106,6 +106,7 @@
$element.dialog('widget').attr('data-offset-' + edge, '');
+ $element.closest('[role="dialog"]').wrap('<div class="offcanvas-wrapper"></div>');
$(window)
<html>
<head>
</head>
<body>
<h1><a href="#" id="login">login</a></h1>
<h1><a href="#" id="logout">logout</a></h1>
<h1><a href="#" id="get-node-1">get node 1</a></h1>
<script type="text/javascript" src="https://code.jquery.com/jquery-3.1.0.min.js"></script>
<script type="text/javascript">
'dialog:aftercreate': function (event, dialog, $element, settings) {
if ($element.is('#drupal-offcanvas')) {
var eventData = {settings: settings, $element: $element};
// Add dialog id for CSS!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
$('.ui-dialog-offcanvas').attr('id','dialog-offcanvas');
$element
.on('dialogresize.outsidein', eventData, debounce(bodyPadding, 100))
.on('dialogContentResize.outsidein', eventData, handleDialogResize)
.trigger('dialogresize.outsidein');
<?php
namespace Drupal\outside_in\Ajax;
use Drupal\Core\Ajax\OpenDialogCommand;
/**
* Defines an AJAX command to open content in a dialog in a off-canvas tray.
*
* @ingroup ajax
@tedbow
tedbow / block.php
Created June 22, 2016 18:13
suggestions
$new_region = NULL;
if (!isset($regions[$this->region]) && $this->status()) {
if (isset($this->original)) {
$original_region = $this->original->getRegion();
// If \Drupal\block\BlockInterface::BLOCK_REGION_NONE was used to
// disable the block and we have an original region then keep in the
// block in the original region.
if (isset($regions[$original_region]) && $this->region == BlockInterface::BLOCK_REGION_NONE) {
$new_region = $original_region;
}
@tedbow
tedbow / various-git.txt
Created June 15, 2016 13:33
Various git
Let’s say that I am on the master branch. But I wanted slothparadise.txt from the devel branch.
git checkout devel -- slothparadise.txt
@tedbow
tedbow / drude-how-to.txt
Created May 25, 2016 19:20
How I start a new project with drude.txt
1. read https://github.com/blinkreaction/drude - do 1 time setup
2. git clone --depth 1 git@github.com:tedbow/drude-d8-start.git
3.
3. drupal site:new docroot
@tedbow
tedbow / test_constructor.php
Created May 21, 2016 19:59
test_constructor.php
/**
* Constructs a new UserLoginResource object.
*
* @param \Drupal\Core\Flood\FloodInterface $flood
* The flood controller.
* @param \Drupal\user\UserStorageInterface $user_storage
* The user storage.
* @param \Drupal\Core\Access\CsrfTokenGenerator $csrf_token
* The CSRF token generator.
* @param \Drupal\user\UserAuthInterface $user_auth