Skip to content

Instantly share code, notes, and snippets.

@elistone
elistone / MYMODULE.install
Created November 5, 2021 10:56
Drupal 8/9 - Add new properties to a field type
/**
* Add new property to all fields of type FIELD_TYPE.
*/
function MYMODULE_update_8001() {
$field_type = 'FIELD_TYPE'; // ID of the FieldType you are updating
$new_properties = [
'FIELD_NAME' => [ // Field name should match the name in the schema
'description' => 'FIELD_DESCRIPTION', // Give your field a description
'type' => 'FIELD_TYPE', // @see: https://www.drupal.org/docs/7/api/schema-api/data-types/data-types-overview
]
@elistone
elistone / addtoany_service_codes.md
Last active July 20, 2021 15:20
AddToAny Service Codes

As of today (2021/07/20) this is a full list of all the AddToAny Service codes taken from: https://www.addtoany.com/services/

"amazon_wish_list",
"aol_mail",
"balatarin",
"bibsonomy",
"bitty_browser",
"blogger",
"blogmarks",
@elistone
elistone / setup.md
Last active August 6, 2023 12:12
MacOS Multiple PHP versions with switching.
@elistone
elistone / FindOrCreateTaxonomyTrait.php
Created January 28, 2020 13:39
Drupal 8 - Find or Create Taxonomy Trait
<?php
namespace Drupal\MY_MODULE_NAME;
use Drupal\Core\Entity\EntityStorageException;
use Drupal\taxonomy\Entity\Term;
trait FindOrCreateTaxonomyTrait {
/**
@elistone
elistone / ionos.sh
Last active November 26, 2019 20:37 — forked from leymannx/ionos.sh
1&1 ionos shared webhosting command line PHP 7.3, Drush 9, Composer, for Drupal 8
# https://www.ionos.com/community/hosting/php/using-php-composer-in-11-ionos-webhosting-packages/
php -v
# PHP 4.4.9 (cgi-fcgi) (built: Nov 7 2018 13:27:00)
# Copyright (c) 1997-2008 The PHP Group
# Zend Engine v1.3.0, Copyright (c) 1998-2004 Zend Technologies
/usr/bin/php7.3-cli -v
# PHP 7.3.11 (cli) (built: Oct 28 2019 07:22:01) ( NTS )
# Copyright (c) 1997-2018 The PHP Group
@elistone
elistone / apolloExampleTokenReAuthorise.js
Created August 15, 2018 10:08
Apollo VueJS - Token Re-authorisation
import {ApolloLink} from "apollo-link";
import {ApolloClient} from "apollo-client";
import {createHttpLink} from 'apollo-link-http';
import {HttpLink} from "apollo-link-http";
import {InMemoryCache} from "apollo-cache-inmemory";
const customFetch = (uri, options) => {
// set a reference to the refresh promise
@elistone
elistone / .bash_profile
Created June 29, 2017 20:48 — forked from natelandau/.bash_profile
Mac OSX Bash Profile
# ---------------------------------------------------------------------------
#
# Description: This file holds all my BASH configurations and aliases
#
# Sections:
# 1. Environment Configuration
# 2. Make Terminal Better (remapping defaults and adding functionality)
# 3. File and Folder Management
# 4. Searching
# 5. Process Management
@elistone
elistone / Drupal-IE-scss-Mixin.md
Last active April 27, 2016 15:22
Drupal If IE scss mixin