Skip to content

Instantly share code, notes, and snippets.

View rocketeerbkw's full-sized avatar

Brandon Williams rocketeerbkw

View GitHub Profile
@webchick
webchick / drupal-hooks-by-implementation
Last active April 9, 2020 10:00
A list of hooks in all* Drupal contrib modules (6.x and 7.x), in descending order of how often they're implemented. (Consolidated a few that were renamed between 6 and 7) * Within a rounding error. :P
Array
(
[hook_menu] => 6744
[hook_uninstall] => 4742
[hook_perm(ission)] => 4012
[hook_install] => 3751
[hook_theme] => 3525
[hook_schema] => 3003
[hook_help] => 2465
[hook_form_alter] => 2273
@abulte
abulte / drupal-7-fetch-siblings-menu.php
Created October 24, 2013 12:05
Drupal 7 Fetch siblings of node in menu
<?php
// requires Menu Node API https://drupal.org/project/menu_node
// [ALB] ripped from submenutree.module
// Traverse down the tree to find our node, following in_active_trial
// This code stanza is loosely inspired by menu_set_active_trail()
$item = $current_item;
$tree = menu_tree_all_data($item['menu_name'], $item);
$my_tree = FALSE;
@webchick
webchick / gist:956a2d7a49c7490fefb5
Last active December 3, 2019 09:25
Most popular D7 modules (as of July 16, 2015)
SELECT n.title, SUM(w.count) as total
FROM project_usage_week_release w
INNER JOIN field_data_field_release_project r ON w.nid = r.entity_id
INNER JOIN node n ON n.nid = r.field_release_project_target_id
INNER JOIN
field_data_field_release_version v ON v.entity_id = r.entity_id
WHERE LEFT(v.field_release_version_value, 3) = '7.x'
AND FROM_UNIXTIME(w.timestamp) BETWEEN CURDATE()-INTERVAL 2 WEEK AND CURDATE()
GROUP BY n.title
ORDER BY total DESC;