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
// ==UserScript== | |
// @name Drupal.org Blacklist | |
// @description Helps indicate people on Drupal.org that I have blacklisted from providing help. | |
// @author Dave Reid | |
// @version 1.0 | |
// @include http://drupal.org/* | |
// @include https://drupal.org/* | |
// @include http://*.drupal.org/* | |
// @include https://*.drupal.org/* | |
// ==/UserScript== |
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
<?php | |
/** | |
* Implements hook_drush_command(). | |
*/ | |
function custom_local_drush_command() { | |
$items['files-fix-permissions'] = array( | |
'description' => 'Fix file permissions', | |
'options' => array( | |
'owner' => "The name of the user to assign ownership of all files with chown(). Defaults to \$USER.", |
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
<?php | |
function drupal_deliver_minimal_html_page($page_callback_result) { | |
if (is_int($page_callback_result)) { | |
return drupal_deliver_html_page($page_callback_result); | |
} | |
// Emit the correct charset HTTP header, but not if the page callback | |
// result is NULL, since that likely indicates that it printed something | |
// in which case, no further headers may be sent, and not if code running |
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_panels_pre_render(). | |
*/ | |
function custom_panels_pre_render($display, $renderer) { | |
// To switch a panel's layout on the fly, you need to not only set | |
// the display's layout, but also swap out the layout plugin in the | |
// renderer object. | |
ctools_include('plugins', 'panels'); | |
if ($plugin = panels_get_layout($layout)) { | |
$display->layout = $layout; |
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
<?php | |
/** | |
* Implements hook_field_views_data_alter(). | |
* | |
* Views disables sorting on any field columns that have a schema type of 'text' | |
* even though it's valid to sort on those fields. Force those field columns to | |
* have a sort available in Views. | |
* | |
* CAUTION: Sorting on these fields may cause performance issues with queries. |
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
<?php | |
function entity_get_operation_links($entity_type, $entity, $base_path = NULL) { | |
$build = array( | |
'#theme' => 'links__operations__' . $entity_type, | |
'#links' => array(), | |
'#attributes' => array('class' => array('links inline')), | |
); | |
list($entity_id) = entity_extract_ids($entity_type, $entity); |
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
<?php | |
// Twig development settings. | |
$settings['twig_debug'] = TRUE; | |
$settings['twig_auto_reload'] = TRUE; | |
$settings['twig_cache'] = FALSE; | |
// Use FileStorage. | |
// @see http://drupal.org/node/1908440 | |
// @see http://drupal.org/node/1899842 |
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
<?php | |
/** | |
* Implements hook_uninstall(). | |
*/ | |
function mymodule_uninstall() { | |
$fields = field_read_fields(array('module' => 'mymodule')); | |
$instances = field_read_instances(array('field_name' => array_keys($fields))); | |
foreach ($instances as $instance) { | |
if (isset($instance['settings']['my_added_setting'])) { |
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
<?php | |
/** | |
* Custom field default value function for entity reference fields. | |
*/ | |
function entityreference_get_default_handler_value($entity_type, $entity, $field, $instance, $langcode) { | |
if (!isset($instance['settings']['default_handler']) || !isset($instance['settings']['default_handler_settings'])) { | |
return array(); | |
} |
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
<?php | |
/** | |
* Implements hook_field_widget_WIDGET_TYPE_form_alter(). | |
* | |
* Make some visual tweaks to the inline entity form and it's subforms. | |
*/ | |
function custom_field_widget_inline_entity_form_form_alter(&$element, &$form_state, $context) { | |
$info = entity_get_info($element['entities']['#entity_type']); |