Asset field type deletion

edited April 2014 in Share
I'm using the "asset" field type in a model's form_fields() method, and I'm wondering how to set a "delete" option for that field? Eg if I specify:
$imgfield = array( 'comment' => 'Image will be resized to 520px wide max.', 'type' => 'asset', 'folder' => 'images/_uploads/garages', 'hide_options' => TRUE, 'overwrite' => FALSE, 'width' => 520, 'height' => 390, 'maintain_ratio' => TRUE, 'resize_and_crop' => TRUE, 'master_dim' => 'height', 'after_html' => 'Some advice about images here...' );
then fields that use this array have no GUI means of deleting the file (the field could be emptied & saved but then weirdly, 2 "after_html" elements are created!).

Does this require some custom handling?

Comments

  • edited 1:25PM
    That would require some custom coding. The fuel/modules/fuel/libraries/Fuel_custom_fields::asset() method handles the rendering of that field along with the fuel.fields.asset_field function in the fuel/modules/fuel/assets/js/fuel/custom_fields.js file for the javascript. The fuel.fields.asset_field function looks for an HTML class of "asset_select" and then dynamically adds those buttons (with classes of "asset_upload" and "asset_select_button") to select or upload an image. You would need to make some modifications in that function or create your own custom field that does this by perhaps copying over the javascript from that function and making the custom field association in the fuel/application/config/custom_fields.php config file.
Sign In or Register to comment.