Skip to content

Instantly share code, notes, and snippets.

@jmolivas
jmolivas / symfony-drupal.md
Last active November 28, 2018 04:40
Drupal related tools based on modern PHP development and Symfony components
@jmolivas
jmolivas / autocomplete.sh
Last active August 20, 2018 14:37
install Drupal Console
#Bash or Zsh: Add this line to your shell configuration file:
source "$HOME/.console/console.rc" 2>/dev/null
#Fish: Create a symbolic link
ln -s ~/.console/drupal.fish ~/.config/fish/completions/drupal.fish
<?php
function name_theme_preprocess_page() {
// ...
$variables['social_networks'] = theme_get_setting('social_networks', 'name_theme');
}
@jmolivas
jmolivas / Vagrantfile.local
Last active April 18, 2018 07:24
Executing DrupalConsole commands on a project with DrupalVM using vagrant-exec plugin no need to create a site alias configuration or ssh into the VM. Project file is config/Vagrantfile.local
if Vagrant.has_plugin?('vagrant-exec')
config.exec.commands '*', directory: '/var/www/drupal'
end
@jmolivas
jmolivas / chain-mysql.sh
Last active January 22, 2018 21:37
How to download and install Drupal 8 using Drupal Console
drupal chain --file=~/.console/chain/quick-start-mysql.yml

Update site

composer update drupal/console --with-dependencies

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

Update launcher 

@jmolivas
jmolivas / 2018-talks.md
Last active January 3, 2018 22:17
Planned sessions for events during 2018

Planned sessions for events during 2018

Improving Drupal 8 development workflow

Drupal 8 has changed a lot and the process of creating, building, testing and deploying a site is not the exception.

During this session, you will understand the process of creating, building, testing and deploying Drupal 8 sites, and learn which tools you can use to improve your local development workflow and reduce project setup and onboarding time, implement automated analysis tools for code review, code coverage and finally how to build an artifact and deploy your project.

Writing CLI Commands for Drupal 8

@jmolivas
jmolivas / ._README.md
Last active January 2, 2018 15:57
Basic docker configuration for drupal projects

Basic docker configuration for drupal projects

Extra steps

  1. If not using DrupalConsole you will need to add the vlucas/phpdotenv dependency to load the .env file. You can do that using composer:
composer require vlucas/phpdotenv
  1. Add the TRAEFIK_HOST value to /etc/hosts
@jmolivas
jmolivas / module_name.install
Last active December 4, 2017 16:52
Change the text field maximum length
<?php
/**
* Update the length of a text field which already contains data.
*
* @param string $entity_type_id
* @param string $field_name
* @param integer $new_length
*/
function _module_change_text_field_max_length ($entity_type_id, $field_name, $new_length) {
@jmolivas
jmolivas / module_name.install
Created November 24, 2017 18:41
Update field data table and configuration storage object.
<?php
/**
* Update field data table and configuration storage
*/
function _update_field_data(
$entityType,
$field,
$valueMapping,