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
/** | |
* Adds the default body field to a node type. | |
* | |
* @param $type | |
* A node type object. | |
* @param bool $subject | |
* (optional) Include a summary field. Defaults to TRUE. | |
* @param $label | |
* (optional) The label for the body instance. | |
* |
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
#!/bin/bash | |
# This has to be run from master | |
git checkout master | |
# Update our list of remotes | |
git fetch | |
git remote prune origin | |
# Remove local fully merged branches | |
git branch --merged master | grep -v 'master$' | xargs git branch -d |
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
#!/bin/bash | |
validTarget() { | |
if [ -z "$1" ]; then | |
echo "no arg" | |
return 1 | |
fi | |
for i in d8 d82 d83 | |
do | |
if [ $i == $1 ]; then |
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
#!/bin/bash | |
if [ $# -ne 1 ]; then | |
echo "Usage die-defaults site-name" | |
exit 1; | |
fi | |
if [ -d "./app/sites/$1" ]; then | |
if [ -d "./app/sites/default" ]; then | |
sudo rm -rf ./app/sites/default; | |
cd ./app/sites | |
ln -s $1 default |
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
// Before. | |
$vars['foobar'] = array( | |
'#markup' => theme('yomamma', array('foo' => $foo, 'bar' => $bar); | |
); | |
// After. | |
$vars['foobar'] = array( | |
array( | |
'#theme' => 'yomamma', | |
'#foo' => $foo, |
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
$node = node_load(1); | |
// I want field_foobar; | |
$value = FALSE; | |
if ($items = field_get_items('node', 'field_foobar')) { | |
$item = reset($items); | |
// A lot of fields use value, some use target_id, tid, it depends on their hook_field_schema. | |
// Good luck with that. | |
$value = $item['value']; | |
} |
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_block_info(). | |
*/ | |
function forum_block_info() { | |
$blocks['active'] = array( | |
'info' => t('Active forum topics'), | |
'cache' => DRUPAL_CACHE_CUSTOM, | |
'properties' => array('administrative' => TRUE), | |
); |
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 | |
* Contains \Drupal\forum\Plugin\Block\ActiveTopicsBlock. | |
*/ | |
namespace Drupal\forum\Plugin\Block; | |
/** |
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 | |
/** | |
* Place the views exposed search block. | |
*/ | |
function YOURPROFILE_update_7001() { | |
$default_theme = variable_get('theme_default', 'YOURTHEME'); | |
// Enable some standard blocks. | |
$blocks = array( | |
array( | |
'module' => 'views', |
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 | |
* Contains \Drupal\system\Plugin\Block\SystemBrandingBlock. | |
*/ | |
namespace Drupal\system\Plugin\Block; | |
use Drupal\block\BlockBase; |
OlderNewer