This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//Drupal 8 version | |
$query = \Drupal::entityQuery('node'); | |
$next = $query->condition('created', $created_time, '>') | |
->condition('type', 'article') | |
->sort('created', 'ASC') | |
->range(0, 1) | |
->execute(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* @file | |
* Contains \Drupal\matthew\Plugin\Block\NextPreviousBlock. | |
*/ | |
namespace Drupal\matthew\Plugin\Block; | |
use Drupal\Core\Block\BlockBase; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Filesystem 1K-blocks Used Available Use% Mounted on | |
/dev/mapper/VolGroup-lv_root 36776648 21401088 13507376 62% / | |
tmpfs 1962560 0 1962560 0% /dev/shm | |
/dev/sda1 495844 167766 302478 36% /boot |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if ($controller['callback'] === '_services_entity_resource_callback' && $controller['args'][0]['default value'] === 'create' && isset($args[2]) && is_array($args[2])) { | |
$args[2]['author'] = $user->uid; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function radius_program_field__field_video_reference__program(&$vars) { | |
foreach ($vars['element']['#items'] as $delta => $video){ | |
$node_id = key($vars['element'][$delta]['node']); | |
$vars['element'][$i]['node'][$node_id]['#node']->number = $delta+1; | |
} | |
return theme_field($vars); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"payment_plan": { | |
"payment_plan": "monthly", | |
"pid": "201", | |
"label": "Payment Plan", | |
"created": "1410301317", | |
"changed": "1410381982", | |
"url": "http://nbcupowerdev.prod.acquia-sites.com/user/191#profile-payment_plan", | |
"user": { | |
"uri": "http://nbcupowerdev.prod.acquia-sites.com/api/v1/account/191", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
uuid: 434042ca-2451-4b99-8e09-9ced5fb6bc1e | |
langcode: en | |
status: true | |
dependencies: | |
module: | |
- matthew | |
theme: | |
- matt | |
id: mycustomblock | |
theme: matt |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* @file | |
* Contains \Drupal\yourmodule\Plugin\Block\YourBlockName. | |
*/ | |
namespace Drupal\yourmodule\Plugin\Block; | |
use Drupal\Core\Block\BlockBase; | |
/** | |
* Provides my custom block. | |
* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
POST /api/v1/user/upload_image HTTP/1.1 | |
Host: nbcupowerdev.prod.acquia-sites.com | |
Content-Length: 978 | |
Authorization: Basic YWRtaW46U2Q0UmdoYjVmWWVhNXg1WGEycENmY1Y= | |
Cache-Control: no-cache | |
Origin: chrome-extension://fdmmgilgnpjigdojojpjoooidkmcomcm | |
X-CSRF-Token: gdlZFsR0S2Jt7O1eGXYvdyk2G_FFmMVFP5NYz0gfwsU | |
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2125.111 Safari/537.36 | |
Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryu5fOXVYOup55Up59 | |
Accept: */* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//Approach 1 with json encode/decode | |
$obj1 = new stdClass(); | |
$obj1->prop1 = 'hello'; | |
$obj1->prop2 = 'world'; | |
$obj2 = new stdClass(); | |
$obj2->prop1 = 'hello'; | |
$obj2->prop2 = 'world'; |