Change hook order

Different implementations of the same hook execute in an order based on the weight value in the system table then the alphabetical order. You can change the order by updating the weight in the db but it could be more fine tuned to just change the hook order by using hook_module_implements_alter().

  1. /**
  2.  * Implements hook_module_implements_alter().
  3.  */
  4. function mymodule_module_implements_alter(&$implementations, $hook) {
  5. // Function authcache_authcache_preclude must be executed after
  6. // anothermodule_authcache_preclude.
  7. if($hook == 'authcache_preclude') {
  8. if (array_key_exists('authcache', $implementations)) {
  9. $my_module = $implementations['authcache'];
  10. unset($implementations['authcache']);
  11. $implementations['authcache'] = $my_module;
  12. }
  13. }
  14. }

Form field conditionnal display

In this snippet the text field mycustom is only displayed if the value of the select field myoptions is custom

Theme and render

display some content using drupal_render() and theme (this is the official way to use theme function)

Simple block definition

Define and set content into a block. See hook_block_configure and hook_block_save if you want people be able to choose options.

Form declaration (from menu to submit)

Output a simple form, with validation and submit handlers

Jquery file structure declaration

Declare custom jquery code (attached to a theme or module) so that $ selector is available