Image + layout Definition

edited December 2010 in Feature Requests
Wasn't sure where to post this..

Here: http://www.getfuelcms.com/user_guide/modules/tutorial states:

"A field name that ends in image or img will automatically be turned into an image select field/upload field."



Does this work when defining a layout in my_fuel_layouts? I thought I had it working once but with:

'header_image' => array('type' => 'textarea', 'description' => 'Header Image'),

It's not. I dropped the 'type' from it and no change. At the moment I'm using a textarea and the image button. Works fine but it's just for an image..

Comments

  • edited 4:43AM
    It doesn't work the same with layouts unfortunately. You have to create the 2 separate fields like so:
    
    'header_image' => array('description' => 'Header Image', 'class' => 'asset_select images', 'upload_path' => assets_server_path('', 'images'),
    'header_upload_image' => array('type' => 'file', 'description' => 'Header Image'),
    
  • edited 4:43AM
    Ah cool thanks for that. Is that documented and I just missed it or?

    So you'd use the on_before_save method to decide which form value to use yeah?
  • edited 4:43AM
    That isn't documented anywhere... I'll call that out. You could use the on_before_save method... actually, if you change header_upload_image to header_image_upload, it will automatically set the value of header_image to the name of the uploaded image (if you are uploading). The suffix '_upload' triggers that.
Sign In or Register to comment.