Skip to content

Instantly share code, notes, and snippets.

@carwin
Created January 19, 2013 03:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save carwin/4570607 to your computer and use it in GitHub Desktop.
Save carwin/4570607 to your computer and use it in GitHub Desktop.
Textmate command to quickly modify a field's weight within `hook_form_alter`
/**
* WTF?
* - This will let you define a shortcut like
* `derp` so that when you type `derp` and
* hit TAB, you get:
* $form['field_name']['#weight'] = weight;
*
* - 'field_name' and 'weight' are variables,
* which means that Textmate will auto-focus
* your current position to the first one and
* let you TAB over to the second one.
*
* INSTALL
* 1. Edit Bundles
* 2. Choose PHP bundle
* 2. CMD + N, select Command
* 4. Fill out the info on the right
* 5. Drop this into the script area
*
*/
\$form['${1:field_name}']['#weight'] = ${2:weight};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment