This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
*Implements hook_form_alter() | |
*/ | |
function alterforms_form_alter(&$form, $form_state, $form_id) { | |
// Initial zone | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$values = \Drupal::service('name.service')->methodFromService(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Context: Within a formElement, inside a FormWidget | |
$element += array( | |
'#type' => 'fieldset', | |
'#attributes' => array('class' => array('container-inline')), | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
http://blog.netgloo.com/2016/04/16/drupal-8-creating-a-new-custom-field-type/ | |
https://stackoverflow.com/questions/38996037/drupal-8-field-plugin-with-field-type-managed-file?rq=1 | |
https://evolvingweb.ca/blog/burrito-maker-how-create-custom-fields-drupal-8 | |
https://github.com/geerlingguy/demo-drupal-8/tree/master/core/lib/Drupal/Core/Field/Plugin/Field | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## From a current timestamp (today) to a date | |
$today = DrupalDateTime::createFromTimestamp(time()); | |
## From a current timestamp to a future date (six months ahead) | |
$next = DrupalDateTime::createFromTimestamp(strtotime('+6 months', time())); | |
## And using it to poblate a datefield within a Drupal Form (by example) | |
$element['nextdate'] = [ | |
'#type' => 'datetime', | |
'#title' => t('See you'), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# A global recipe to set up a new workstation. For the on-boarding of new workmates. | |
## Getting Google Chrome | |
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb | |
sudo apt-get install libxss1 libgconf2-4 libappindicator1 libindicator7 | |
sudo dpkg -i google-chrome-stable_current_amd64.deb | |
## Setting up a LAMP environment | |
sudo apt-get update | |
sudo apt-get install apache2 mysql-server php libapache2-mod-php php-mcrypt php-mysql |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git rm -r --cached . | |
git add -A | |
git commit -am 'Basic workflow to clean git with ignored files from a new gitignore' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Compiled source # | |
################### | |
*.com | |
*.class | |
*.dll | |
*.exe | |
*.o | |
*.so | |
# Packages # |