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
@davidjguru
davidjguru / Send commit to Drupal.org Git
Last active March 17, 2018 14:17
Drupal commit with author (format)
git commit -m "Text for the commit." --author="davidjguru <davidjguru@1024022.no-reply.drupal.org>"
@davidjguru
davidjguru / day-to-day prompt.txt
Created March 23, 2018 11:42
Common day-to-day commands for a damaged brain
# Recursive grep
$ grep -R -e “string” /path/
@davidjguru
davidjguru / formexample.info.yml
Created April 9, 2018 14:38
formexample file info
name: Form Example
type: module
description: Demonstrates how to build a form with Form API
package: Custom
core: 8.x
@davidjguru
davidjguru / formexample.routing.yml
Created April 9, 2018 14:50
formexample routing file
formexample_form:
path: 'formexample/myform'
defaults:
_title: 'Form Example Drupal 8'
_form: '\Drupal\formexample\Form\FormExample'
requirements:
_permission: 'access content'
@davidjguru
davidjguru / FormExample.php
Created April 9, 2018 14:58
formexample class file php
<?php
/**
* @file
* Contains \Drupal\formexample\Form\FormExample.
*/
namespace Drupal\formexample\Form;
use Drupal\Core\Form\FormBase;
@davidjguru
davidjguru / drupal7-multistep-form-example.php
Created April 15, 2018 18:43 — forked from drmalex07/drupal7-multistep-form-example.php
An example with multistep forms in drupal7. #drupal #drupal7 #multistep-form
<?php
function helloworld_multistep_example_form($form, &$form_state)
{
// We add 2 keys to form_state ("step" and "state") to keep track
// of state in a multistep form.
$step = isset($form_state['step'])? ($form_state['step']) : (1);
$form['heading'] = array(
'#type' => 'markup',
@davidjguru
davidjguru / alterforms.info.yml
Created April 20, 2018 12:45
Alterforms for Drupal 8 (info file)
name: Alter Forms
description: Custom module to alter forms
package: Development
type: module
core: 8.x
dependencies:
- devel:kint
- search_kint:search_kint
@davidjguru
davidjguru / alterforms.module (initial)
Last active April 20, 2018 14:02
Initial Version: Alterforms for Drupal 8, module file
<?php
/**
*Implements hook_form_alter()
*/
function alterforms_form_alter(&$form, $form_state, $form_id) {
// Initial zone
@davidjguru
davidjguru / Installing_drush_launcher.txt
Created May 4, 2018 11:25
Drush Launcher Installation
## Get the Drush Launcher
wget -O drush.phar https://github.com/drush-ops/drush-launcher/releases/download/0.6.0/drush.phar
## Make downloaded file executable
chmod +x drush.phar
## Move drush.phar to a location listed in your $PATH, rename to drush
sudo mv drush.phar /usr/local/bin/drush
## Update the tool
@davidjguru
davidjguru / drupal_call_to_service.txt
Created May 7, 2018 14:45
Drupal 8 general Services Calling
$values = \Drupal::service('name.service')->methodFromService();