Jump to content

"not ready to use" error of FieldtypeImage


didhavn
 Share

Recommended Posts

Hey all.

I am trying to create an image-field from API. It is working fine, but opening the page with the new image-field leads to the following error:

FieldtypeImage: Field "servicetype_image_1129" is not yet ready to use and needs to be configured.

For all other fields I am creating in this module (e.g. checkbox, textarea)...everything is working without errors.

This is my code to create the image-field:

$f_img = new Field();
$f_img->type  = $this->modules->get("FieldtypeImage");
$f_img->name  = 'servicetype_image_' . $page->id;
$f_img->label = $page->get('title')->getDefaultValue() . ' Service-Type Image';
$f_img->set('tags',$tag);
$f_img->set('icon',$icon);
$f_img->set('maxFiles', '1');
$f_img->set('noLang', 1);
$f_img->set('adminThumbs', 1);
$f_img->set("textformatters", array("TextformatterEntities"));
$f_img->save();

Anybody an idea what is causing the problem?

Thanks a lot in advance!!

Link to comment
Share on other sites

  • 6 years later...

hm... doesn't work for me. Here's my code:

if(!$fields->get('custom_product_images')) :
	$custom_product_images = new Field(); 
	$custom_product_images->type = $this->modules->get("FieldtypeImage"); 
	$custom_product_images->title = 'Custom Product Images'; 
	$custom_product_images->name = $this->wire('sanitizer')->pageName($custom_product_images->title, true);
	$custom_product_images->label = 'Product Images';
	$custom_product_images->ext = 'gif jpg jpeg png';
	$custom_product_images->tags = 'custom product';
	$custom_product_images->set("textformatters", array("TextformatterEntities"));
	$custom_product_images->save();
endif;

I think my field needs to be an "Array of items" at all times, and not "Automatic". How to define that with API? 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...