[development] Capturing $form array of a specific content type

As If Productions everyone at asifproductions.com
Thu Oct 14 19:20:01 UTC 2010

At 10:50 AM 10/14/2010, Sam Tresler wrote:
>Could be I am missing something easy here, but is there a standard 
>way to get the $form array of a node/add/* right before it would be rendered.

I wouldn't call this standard, but you can put something like this in 
a custom module:

function MY_MODULE_form_alter(&$form, $form_state, $form_id) {
   if($form['#id'] == 'MY_CONTENT_TYPE') {
     $debugging = ($_SERVER['REMOTE_ADDR'] == '111.222.333.444') ? 1 : 0;
     if($debugging) {
       echo "<textarea cols=150 rows=20 style='font-size: 10px;'>";
       echo "\n" . htmlentities(print_r($form,1));
       echo '</textarea>';

Replace "MY_MODULE" with your module name.  Replace "MY_CONTENT_TPE" 
with your content type.  Replace "111.222.333.444" with your own IP address.

This will spit out a big textbox full of the form data, that only you can see.


As If Productions
Interactive Worlds and Immersive Obsessions

More information about the development mailing list