Skip to content

Instantly share code, notes, and snippets.

composer update drupal/console --with-dependencies
@jmolivas
jmolivas / MODULE_NAME.module
Last active November 23, 2016 23:25
Update key value form a key|value list field
<?php
use Drupal\Core\Database\Database;
function module_update_80NN() {
$field = 'field_name';
$tables = [
'node__'.$field,
'node_revision__' .$field
];

Update site

composer update drupal/console --with-dependencies

NOTE: This should be executed within your drupal site root directory.

Update launcher 

@jmolivas
jmolivas / migration-event-class.php
Last active October 26, 2016 15:27
Drupal 8 migration validate `NULL` since is read as string
<?php
// ...
public function onPrepareRow(MigratePrepareRowEvent $event) {
$row = $event->getRow();
$fields = $event->getMigration()->getPluginDefinition()['process'];
foreach ($fields as $destination => $source) {
if (!is_array($destination) && !is_array($source)) {
if ($row->getSourceProperty($source) == "NULL") {
@jmolivas
jmolivas / instructions.md
Last active July 4, 2017 17:56
Download Drupal 8 + DrupalConsole using DrupalComposer

Install Composer
https://getcomposer.org/download/

Install DrupalConsole launcher tool

curl https://drupalconsole.com/installer -L -o drupal.phar
mv drupal.phar /usr/local/bin/drupal
chmod +x /usr/local/bin/drupal

Proposed format:

Drush Command Description Equivalent Will not Implement Notes
config-get Display a config value, or a whole configuration object. config:debug
{
"name": "drupal-composer/drupal-project",
"description": "Project template for Drupal 8 projects with composer",
"type": "project",
"license": "GPL-2.0+",
"authors": [
{
"name": "",
"role": ""
}
@jmolivas
jmolivas / .gitignore_global
Created July 17, 2016 00:55
Global gitignore file
# Composer
vendor
# OS generated files #
######################
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes

Add packagist repository

composer config repositories.drupal composer https://packagist.drupal-composer.org

Download modules using composer

composer require \
drupal/admin_toolbar:^8.1 \