Skip to content

Instantly share code, notes, and snippets.

@btopro
Last active August 29, 2015 14:03
Show Gist options
  • Save btopro/a7df279dac7e249ef059 to your computer and use it in GitHub Desktop.
Save btopro/a7df279dac7e249ef059 to your computer and use it in GitHub Desktop.
module_invoke_all hack to open eyes about drupal core (6 or 7)

Issue the following command if you don't have devel already

drush @drupal7 en devel --y

#Let's hack core!

Rule 1 of Drupal: Don't hack core. Step 2 of this part of the talk: Hack core (butjust a lil tinny tiny bit)

go into includes/module.inc and find module_invoke_all (line 887) on line 888 add dpm($hook);

then run

drush @drupal7 cc all --y

#refresh any page in drupal and be happy!

#common api stuff next up we need to learn more about the drupal api common things may need to modify: http://api.drupal.org

(some mirrors incase that's slow) http://api.drupal.psu.edu/ http://api.elmsln.org/

plug for a cool App for OSX: http://kapeli.com/dash -- offline searchable docs

hook_form_alter()

hook_permissions()

hook_menu()

hook_menu_alter()

hook_init()

remember: We can go back and use knowledge of what hook to call with Sublime to autocomplete an example for us! command + shift + p then start typing the name of a hook and hit enter after you find the one you want.

Last note: http://dropbucket.org/ is a good source of example code snippets across versions of drupal. Think github gist's but just for drupal code snippets.

#now brad will cover hook_field_widget_form_alter() hook_field_widget_WIDGET_TYPE_form_alter()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment