Skip to content

Instantly share code, notes, and snippets.

diff --git a/core/lib/Drupal/Core/Entity/EntityManager.php b/core/lib/Drupal/Core/Entity/EntityManager.php
index d749734..f185573 100644
--- a/core/lib/Drupal/Core/Entity/EntityManager.php
+++ b/core/lib/Drupal/Core/Entity/EntityManager.php
@@ -23,7 +23,6 @@
use Drupal\Core\Field\FieldStorageDefinitionEvents;
use Drupal\Core\Field\FieldStorageDefinitionInterface;
use Drupal\Core\Field\FieldStorageDefinitionListenerInterface;
-use Drupal\Core\KeyValueStore\KeyValueFactory;
use Drupal\Core\KeyValueStore\KeyValueFactoryInterface;
@alexpott
alexpott / gist:3589386
Created September 1, 2012 22:21
drush breaking due to config.canonical
Fatal error: Uncaught exception 'Exception' with message 'The configuration directory type <em class="placeholder">active</em> does not exist.' in /Users/alex/dev/sites/drupal8alt.dev/core/includes/bootstrap.inc on line 496
Exception: The configuration directory type <em class="placeholder">active</em> does not exist. in /Users/alex/dev/sites/drupal8alt.dev/core/includes/bootstrap.inc on line 496
Call Stack:
0.0004 709584 1. {main}() /Users/alex/dev/drush5/drush.php:0
0.0152 5153000 2. drush_main() /Users/alex/dev/drush5/drush.php:14
0.0608 12112608 3. _drush_bootstrap_and_dispatch() /Users/alex/dev/drush5/drush.php:59
0.0779 12123136 4. drush_dispatch() /Users/alex/dev/drush5/drush.php:90
0.1052 12142080 5. call_user_func_array() /Users/alex/dev/drush5/includes/command.inc:165
@alexpott
alexpott / gist:5161576
Created March 14, 2013 14:04
Field CMI moving from objects to arrays...
function hook_field_attach_purge(\Drupal\Core\Entity\EntityInterface $entity, $field, $instance) {
// find the corresponding data in mymodule and purge it
- if ($entity->entityType() == 'node' && $field->field_name == 'my_field_name') {
+ if ($entity->entityType() == 'node' && $field['field_name'] == 'my_field_name') {
mymodule_remove_mydata($entity->nid);
}
}
@alexpott
alexpott / gist:5161620
Created March 14, 2013 14:10
Array to object conversion...
+function field_create_field(array $field) {
+ $field = entity_create('field_entity', $field);
+ $field->save();
return $field;
}
<?php
$context = new \Drupal\Core\Config\Context\ConfigContext($this->event_dispatcher);
$context->set('locale.language', WHATEVER_LANGCODE);
$this->configFactory->enterContext($context);
So I think that we're breaking an important principle here... that config should return the data in an identical format to what you provided. At Barcelona @merlinofchaos said that CMI should be a dumb as possible and I think that here we are breaking that maxim.
Just because FAPI returns everything as strings is not a reason to go ahead here. We can leave all the simple config as strings if we want or we can use the schema (if available) to save typed config. But config entities should be allowed to save their data in the types stored on the object.
<?php
/**
* @file
* Install, update and uninstall functions for my project.
*/
/**
* Implements hook_install().
*
@alexpott
alexpott / settings.local.php
Last active November 14, 2016 20:31 — forked from jacine/settings.local.php
settings.local.php
<?php
/**
* @file
* Local development override configuration feature.
*
* To activate this feature, copy and rename it such that its path plus
* filename is 'sites/default/settings.local.php'. Then, go to the bottom of
* 'sites/default/settings.php' and uncomment the commented lines that mention
* 'settings.local.php'.
<?php
namespace Drupal\custom_migration\Plugin\migrate\process;
use Drupal\Component\Utility\Html;
use Drupal\migrate\ProcessPluginBase;
use Drupal\migrate\MigrateExecutableInterface;
use Drupal\migrate\Row;
/**
<?php
/**
* @file
* Install, update and uninstall functions for my project.
*/
/**
* Implements hook_install().
*