Skip to content

Instantly share code, notes, and snippets.

View davidjguru's full-sized avatar
🍅
Working within a pomodoro cycle

David Rodriguez davidjguru

🍅
Working within a pomodoro cycle
View GitHub Profile
@crittermike
crittermike / IntegerDropdownWidget.php
Created October 17, 2016 20:14
Drupal 8 form widget example: creates a select dropdown for integer fields. Place in src/Plugin/Field/FieldWidget
<?php
/**
* @file
* Defines a dropdown widget for integer fields.
*/
namespace Drupal\nba_content_core\Plugin\Field\FieldWidget;
use Drupal\Core\Field\FieldFilteredMarkup;
use Drupal\Core\Field\FieldItemListInterface;
@chx
chx / Table.php
Created December 6, 2018 21:02
Plain table migration source plugin
<?php
namespace Drupal\sd8_migration\Plugin\migrate\source;
use Drupal\migrate\Plugin\migrate\source\SqlBase;
/**
* Table source from database.
*
@Seldaek
Seldaek / ext-requires.txt
Last active February 15, 2020 18:52
PHP Extension Requirements on Packagist.org
Taken from packagist.org
Packages with a master branch update since June 1st 2018: 98977
Of those, package having requires on PHP extensions: 11676 (11.79%)
As only ~12% of packages declare their extension requirements,
and even then it might not be a complete list, take all this with
a big grain of salt, it is informative but definitely not a
complete picture of the most used extensions.
@rajeshpv
rajeshpv / gist:6356679
Last active May 25, 2020 18:14
Install Balsamiq for ubuntu
helpfull links
(1) https://gist.github.com/cbednarski/5379830
(2) http://www.clarifylinux.org/2012/04/ubuntu-1204-tweak-and-hack-round-up.html
(3) http://jeffhendricks.net/?p=68
(4) BEST for 64 bit http://www.randomhacks.co.uk/how-to-install-balsamiq-mockups-on-ubuntu-13-10/
The steps I did
RUN>>
locate libgnome-keyring.so /usr/lib/i386-linux-gnu/libgnome-keyring.so.0 /usr/lib/i386-linux-gnu/libgnome-keyring.so.0.2.0
@Erikdekamps
Erikdekamps / module.install
Last active May 27, 2021 12:56
Drupal 8 - Load taxonomy terms sorted by weight
/**
* Get taxonomy terms sorted by weight.
*
* @param int $vid
* The vocabulary id.
*
* @return array
* Returns an array of term id | name.
*
* @throws \Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException
@himerus
himerus / nodemaker_term_create.php
Created January 21, 2017 11:38
Create a taxonomy term programmatically in Drupal 8.
<?php
/**
* @file
* Contains various helper functions.
*/
use Drupal\taxonomy\Entity\Term;
/**
@Jaesin
Jaesin / delete_content_entities.d8.php
Created June 22, 2015 07:14
Delete all content entities in Drupal 8.
<?php
// Delete all nodes.
entity_delete_multiple('node', \Drupal::entityQuery('node')->execute());
// Delete all files.
entity_delete_multiple('file', \Drupal::entityQuery('file')->execute());
// Delete all taxonomy terms.
entity_delete_multiple('taxonomy_term', \Drupal::entityQuery('taxonomy_term')->execute());
@signalpoint
signalpoint / example.php
Last active July 16, 2022 23:41
Drupal 8 Set Message Example
<?php
// The drupal_set_message() function is being deprecated!
// @see https://api.drupal.org/api/drupal/core%21includes%21bootstrap.inc/function/drupal_set_message/8.5.x
// > Deprecated in Drupal 8.5.0 and will be removed before Drupal 9.0.0.
// > Use \Drupal\Core\Messenger\MessengerInterface::addMessage() instead.
// In some custom code.
\Drupal::messenger()->addMessage('Say something else');
@gueno
gueno / Drupal Multisite Drush Script
Created February 4, 2012 14:08
If you're running multiple sites on one drupal installation, here is a script to run different Drush commands on all of them
#!/bin/bash
# Get all Drupal sites
sites=`find . -maxdepth 1 -type d -print | grep -v '/all$' | grep -v '/default$' | grep -v '\.$'`
echo "Choose the commande to execute : "
echo "1. update"
echo "2. put sites offline"
echo "3. put sites online"
echo "4. clear all cache"
@markf3lton
markf3lton / blt-hands-on-tutorial.md
Last active February 1, 2023 18:24
BLT Hands On Tutorial