Skip to content

Instantly share code, notes, and snippets.

View keopx's full-sized avatar

Ruben Egiguren keopx

View GitHub Profile
@juampynr
juampynr / mymodule.info
Last active June 9, 2023 21:53
Drupal 7 Views 3 custom field handler
dependencies[] = ctools
; Views Handlers
files[] = views/mymodule_handler_handlername.inc
@juampynr
juampynr / upgradepath.drush.inc
Last active December 30, 2015 05:48
Drupal 7's upgrade path
<?php
// NOTE This has been moved to https://www.drupal.org/project/upgradepath
/**
* @file
* Runs a set of steps to upgrade a database to be in line with code.
*/
/**
* Implements hook_drush_command().
#!/bin/bash
function drupal-install() {
sudo rm -rf sites/default;
sudo git checkout -- sites/default;
sudo chmod -R 777 sites/default;
sudo chown -R `whoami` sites/default;
sudo git checkout -- sites/default;
sudo chown -R `whoami` sites/default;
#exit;
@killua99
killua99 / changelog.sh
Created May 7, 2014 21:14
bash script to generate changelog focused for Drupal modules
#!/bin/bash
# Author: Luigi Guevara <@killua99>
#
# Use
# For a Simple Tag changelog
# ./changelog > CHANGELOG.txt
#
# For a current dev branch with the old tag log
# ./changelog 7.x-2.x > CHANGELOG.txt
@sqndr
sqndr / example.jquery.js
Created July 16, 2014 10:45
jQuery plugin example (js)
(function($){
$.fn.extend({
example: function(options) {
var defaults = {
color: '#000000',
}
#!/bin/bash
# Check arguments and requirements.
if [ ${#@} -lt 1 ]; then
echo "This script expects one argument (site machine name)."
exit 1
fi
if [ -x ${HOME}/.my.cnf ]; then
echo "This script requires ${HOME}/.my.cnf."
@keopx
keopx / drupal8_reinstall.sh
Last active April 25, 2017 17:18
Drupal 8 reinstall site script
#!/bin/bash
cd drupal
sudo rm -fr vendor
composer install
sudo chmod 777 sites/default
cd sites/default
rm -fr settings.php services.yml
# for developers only (sets up some dev mode settings, do this before install!)
cp ../example.settings.local.php ./settings.local.php
# for everyone
@facine
facine / __INDEX.txt
Last active August 6, 2023 15:33
Drupal 8 - Examples
# Taxonomy terms:
- https://gist.github.com/facine/35bb291811c146b6fc9e#file-create_taxonomy_term-php
# Menu links:
- https://gist.github.com/facine/35bb291811c146b6fc9e#file-create_menu_link-php
# File items:
- https://gist.github.com/facine/35bb291811c146b6fc9e#file-create_file-php
# Nodes:
@mortendk
mortendk / template-choser.md
Last active April 29, 2016 09:32
Drupal8 concept for selecting templates form the ui

template chooser

Drupal8 is pretty awesome, but its a problem that you cant choose fromt the ui which template to use. Sure you can overwrite whats there (node--article.html.twig) but that dont give the end user a chance to later change in the site & can end up in even more templates & clutter.

template suggestions

Make it easy to provide a template suggestion for entities, blocks, pages, nodes, fields, menues, username, everything that have a template you should be able to give a suggestion.

class selector

A prepopulated list of classes that can be selected for a template.

The modules userbase is sitebuilders & themes that wants to provide variations for a site, developers dont have to provide templates after a site is build, and can rely on the theme to provide all the variations.

Download DrupalConsole

curl https://drupalconsole.com/installer -L -o drupal.phar

Make DrupalConsole globaly accesible

$ mv console.phar /usr/local/bin/drupal