Hello everyone, I am Francesco, 22yo, from Italy. :)
I am new to Drupal community and development.
I am working together with the "Pro Drupal Development" book that seems pretty clear and easy to understand.
During the "module development" part of the book they propose the "annotation" module as an example; probably many of you are familiar with it but, just in case...
It lets you leave simple notes for each node you create together with an administration side that allows you to decide which content types can accept those notes.
I followed, and understood, which is the actual point, the steps given by the book and made "my" module work.
The funny and enjoyable part is when you try to get your modification to come to life.
I did some "cool" modifications like you can have more notes for each node rather than only one, and added a new fieldset (plus the one i already have, together with a textarea, for inserting the new note) to show all the notes previously added by the user.
Those modifications are working and i feel very accomplished but there is an issue i can't figure out.

When i add a note the textarea reacts just ok because it has a reference name like "$node->annotation" so that when i want to view the previous note i added i just can do the SELECT statement and then put the result inside "$node->annotation".

But the problem is that a fieldset doesn't have a name or a reference...So my simple question would be.

ow do i write down something inside a fieldset - without a textarea! - , how can i tell Drupal to put my text in there if i cannot call that element in any way.

Because right now i am printing all the notes about a node without any formatting option so the text just shows up on the top of the page, above the header as well.

Sorry if i made it too long but i wanted to be sure you get the context.

I tagged it "newb" cos i believe that's a fair easy issue to solve.

Thanks to whoever will give me some hints :)

Comments

roger.ajith’s picture

using from attribute item we can write content in the field set
Syntax is
$form[‘item’]=array(‘#type’=>’item’,
‘#prefix’=>’Hello World!!!’,
‘#suffix’=>’Need text’,
);

N4R4YAN’s picture

thank you very much roger.ajith :)
I'll try to apply that to my case. More specificly i have to write down the result of a query. I guess that i just have to replace the "mere text" with what i coded down.

EDIT1: I tried the syntax you suggested me but seems that a fieldset is not shown, as probably the type of the form isn't fieldset at all. Tried to replace "item" with "fieldset" but that is not what i need cos prefix and suffix are out of the fieldset space.

EDIT2: Ok i figured out myself, i tought that syntax was to be applied by itself, instead i had to use it as a hierarchy of the fieldset like

['annotation'] array ( *type as fieldset*) - and - ['annotation']['context'] array ( *type as item with prefix and suffix*)

done :)

now i have to print out the result of my query instead a normal text