Skip to content

Instantly share code, notes, and snippets.

View EclipseGc's full-sized avatar

Kris Vanderwater EclipseGc

View GitHub Profile
<?php
$source_key_schema = array(
'mfg_code' => array(
'type' => 'varchar',
'length' => 255,
'unsigned' => FALSE,
'not null' => TRUE,
'alias' => 'i'
),
<?php
$connection = require_once __DIR__ . '/../sites/default/dbconnection.php';
Database::addConnectionInfo('default', 'default', $connection);
$container->register('database.default', 'Drupal\Core\Database\Connection')
->setFactoryClass('Drupal\Core\Database\Database')
->setFactoryMethod('getConnection')
->setArguments(array('default', 'default'));
{
"name": "drupal/utilty",
"description": "Common utility classes for Drupal components.",
"keywords": ["drupal"],
"homepage": "http://www.drupal.org",
"license": "GPL2+",
"authors": [
{
"name": "Dries Buytaert",
"email": "[email protected]"
services:
block.controllers:
class: Drupal\block\BlockEntityControllers
arguments: ['@service_container', '@module_handler']
tags:
- { name: event_subscriber }
<?php
/**
* @file
* Contains \Drupal\node\NodeEntityControllers
*/
namespace Drupal\node;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
<?php
/**
* @file
* Contains PageManagerCriteriaForm.php.
*/
namespace Drupal\page_manager\Form;
use Drupal\Core\Condition\ConditionManager;
use Drupal\Core\Entity\EntityInterface;
<?php
// Adding a method to TypedDataManager
public function mapDefinition(array $type) {
/** $type comes across as:
*
* "type" = "entity",
* "constraints" = {
* "EntityType" = "node"
<?php
// My code for getting this output.
$definition = new DataDefinition(\Drupal::service('typed_data')->getDefinition('entity'));
$definition->setDataType('entity');
$definition->addConstraint('EntityType', 'node');
drupal_set_message('<pre>' . print_r($definition, TRUE) . '</pre>');
$definition2 = new DataDefinition(\Drupal::service('typed_data')->getDefinition('entity:node'));
drupal_set_message('<pre>' . print_r($definition2, TRUE) . '</pre>');
diff --git a/core/modules/comment/comment.tokens.inc b/core/modules/comment/comment.tokens.inc
index eab4d3e..8cd2602 100644
--- a/core/modules/comment/comment.tokens.inc
+++ b/core/modules/comment/comment.tokens.inc
@@ -12,72 +12,83 @@ function comment_token_info() {
$type = array(
'name' => t('Comments'),
'description' => t('Tokens for comments posted on the site.'),
- 'needs-data' => 'comment',
+ 'needs-data' => 'entity:comment',
<?php
/**
* @file
* Contains PageManagerWizard.php.
*/
namespace Drupal\page_manager\Route;
use Drupal\Core\Controller\ControllerBase;
use Drupal\Core\DependencyInjection\ContainerInjectionInterface;