Hi there,

I'm creating my own module which sets up a custom content type with just a standard title (No 'body') and a series of custom fields. One of which is an image field where I want people to attach/modify an image link.

I've got two questions:

1) I have been in the past using the IMCE CCK module which allows me to add a IMCE field when creating a custom content type through the CCK interface, but how can I create this type of field directly within my own node create/edit form declaration in my own developed module?

Originally I had the following for an image field:

$form['mainimage'] = array(
	'#type' => 'file',
	'#title' => t('Main image'),
	'#description' => t('Main image field for Cartoon of day block'),
	'#default_value' => isset($node->mainimage) ? $node->mainimage : '',		
);

After a good search around, I couldn't find anything which gave any hints, so I tried swapping:

'#type => 'file',

with:

'#type => 'imceimage',

Which actually produces the "[Add image]" link, but doesn't do anything when you click onto it. I think because its missing a fieldname from the end of the URL, but i'm not sure.

Am I on the right tracks?

2) Is there any way I can prevent my content type from displaying anywhere as a page, and only just as a Block view that I define within my module?

Any suggestions/ideas on the above would be really welcome! Many thanks in advance.

Comments

blogbold’s picture

My info was about IMCE, not IMCEimage.

blogbold’s picture

My info was about IMCE, not IMCEimage.