Popular content
Welcome
Fresh(est) from the blog
Recent TechNotes
Pre-fill comment subject line
I often find it handy to make a small module for most of my Drupal project the purpose of which is to perform little tweaks on default Drupal core or other module behavior. Usually this small utility module lives in /sites/all/modules/custom/tweaks/tweaks.module or something to that effect.
Having such a module around is a quick way to tap into the power of Drupal hooks. For example, a client requested that the subject lines of any comments be pre-filled with the node name, prefixed with "Re:". This was easily accomplished with a quick hook_form_alter, like so:
Commonly overridden node form elements
In order to save some time putting print_r in the form override, here are the keys of form elements I often override.
"Menu settings" fieldset = $form['menu']
"Revision information" fieldset = $form['revision_information']
"URL Path Settings" fieldset = $form['path']
"Comment settings" fieldset = $form['comment_settings']
"Authoring information" fieldset = $form['author']
"Publishing options" fieldset = $form['options']
if the publishing options is simply unset, the node will default to unpublished. If you want nodes to always be published, do this:
Overriding forms Drupal 6
I find myself needing to override a form fairly often, and I'm always having to go after the process, so I'm making a note of it here. I often need to override node edit forms in order to get rid of unneeded form elements.
My reference has been this article at lullabot.
The first thing you need is the Form ID. To find this, load the form in question in a browser, then view source. Search the source for "form_id". You should find a hidden element with "form_id" as its name, like so:
Flex Namespaces and MXML
This is kind of cool: if you are making a Flex app and are writing your own classes, you can make a new XML namespace for them to reference in your MXML markup.
The default mx:Application opening tag gives one namespace property:
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml/" layout="absolute">
This makes it so you can prefix the tags in the document with mx: and get all of the pre-built Flex classes, like the Panel, the Application, etc.
Monthly archive
- May 2010 (3)
- April 2010 (1)
- March 2010 (4)
- February 2010 (8)
- January 2010 (2)
- December 2009 (2)
- November 2009 (5)
- October 2009 (4)
- June 2009 (1)
- May 2009 (1)
- April 2009 (4)
- March 2009 (2)
- January 2009 (4)