This file contains hidden or 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
// in preprocessing.php | |
$variables['lead_form'] = | |
\Drupal::formBuilder()->getForm('Drupal\my_form_module\Form\LeadForm', 'hero_video'); | |
//it passes that extra variable through getForm into an arguments array added on the end of buildForm | |
public function buildForm(array $form, FormStateInterface $form_state, string $gated_content_context = NULL) { | |
if($gated_content_context === 'hero_video') { |
This file contains hidden or 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
function greppy | |
{ | |
grep -Hnoir "$1" . | |
} |
This file contains hidden or 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
function drupalnew | |
{ | |
if [ "$1" = "--help" ]; then | |
echo "The drupalnew command takes 2 arguments: drupalnew <sitename | ex: my_site> <version | ex: 8.6.x>" | |
return 1 | |
fi | |
if [ "$1" = "--version" ]; then | |
echo "Drupalnew 0.0.1" | |
return 1 |
This file contains hidden or 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
# $1 is the name of the element to search | |
# $2 is the file to search | |
function checkodd(){ | |
if [ $# -ne 2 ]; then | |
echo "Please use the following format: checkodd <string to check> <location>" | |
else | |
for f in "$2"/* "$2"/**/* ; do | |
if [ -f "$f" ]; then | |
stringcount=$(grep -o $1 $f | wc -l) | |
if [ $((stringcount % 2)) -eq 1 ]; then |
This file contains hidden or 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
# this command will add an alias and source the .zshrc | |
# $1 is the keys for the alias | |
# $2 is what will run. Put in quotes. | |
function newalias | |
{ | |
if [ "$1" != "" ] && [ "$2" != "" ]; then | |
echo 'alias '$1'='"\""$2"\"" >> ~/.zshrc | |
alias "$1"="$2" | |
else | |
echo "The newalias command takes two arguments as follows: newalias <alias command> <alias function, in double quotes>" |
This file contains hidden or 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
function chrome(){ | |
/usr/bin/open -a "/Applications/Google Chrome.app" "$1" | |
} |
This file contains hidden or 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
this.App || (this.App = {}); |
This file contains hidden or 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
/** | |
* implements hook_form_node_form_alter() | |
* @author Daniel Laufer | |
* Add validation to the XXX content type. | |
*/ | |
function mymodule_form_node_form_alter(&$form, FormStateInterface $form_state, $form_id) { | |
// expand paragraph titles | |
$form['#attached']['library'][] = 'mytheme/expand_paragraph'; | |
} |
This file contains hidden or 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
// using https://open-dict-data.github.io/ipa-lookup/en/?# | |
<phoneme alphabet="ipa" ph="/ˈk æp/">cap</phoneme> |