I'm trying to store a format for a field for nodes in a module I've created.
I can add the radio button to the form like this in hook_form()
<?php
/**
* Implementation of hook_form().
*/
function mymodule_form(&$node) {
// ...snip
$form['instructions'] = array(
'#type' => 'textarea',
'#title' => t('User instructions'),
'#cols' => 50,
'#rows' => 8,
'#description' => t('Instructions for the user on how to use this'),
'#default_value' => isset($node->instructions) ? $node->instructions : '',
);
$form['instructions_format'] = filter_form($node->instructions_format);
// ...snip
}
Whichever format I select, when inserting with hook_inster the value of $node->instruction_format is always 0.
I'm searching and googling but not finding... Thanks for any help!
Comments
Forgot ?>
Can't edit first post and forgot to put closing tag for php display
Also in case this is where I'm messing up here's how I'm attempting to implement hook_insert :
Stumbled upon it
Seems I more or less stumbled upon it by luck and gorilla methodology. Imagine a gorilla managing to turn on the radio by randomly slapping around on it - you can say the gorilla turned on the radio, but you can't say that the gorilla learned how to use the radio :)
A combination of half understanding the instructions on p.148 of Pro Drupal Development and the Ubercart sourcecode showing up on page 7 of a google search led me to try this:
I have a field in my database table for this content type names "instructions_format" and the appropriate value gets stored in it (by magic). Now I'm going to go have a banana.
Now lets see if the input format actually gets used when the content is displayed, or if I have to go APE... err... I mean API on it.
And the way to do this, for
And the way to do this, for anybody else stumbling along at home, in the hook_view() implementation, as such :
AHHH thanks you.
I too was sifting through with a bananna looking at page 148 of Pro Drupal Development very confused, beating my chest, eating lice when I found this post.
My problem now is that when I edit, the field isn't populating.. Database is okay and assigned, but nothing in the edit field..
OHHH OHHH AIII AIII OHHH (best ape imitation)
Any help appreciated.