I'm writing an accessory to replace the category image field with a file browser that enables the user to navigate through folders to select their image (because the native category image field is restricted to a single upload directory).
Everything is nearly OK on the front end except that I'm getting
Severity: Warning
Message: Illegal string offset 'value'
Filename: cp/admin_content.php
Line Number: 2223
when submitting the form and looking in the database, the value is d.
When using the native category image field, after choosing an existing image from the file manager, the updated HTML looks like:
<input type="hidden" name="cat_image_hidden" value="file_name.jpg">
<input type="hidden" name="cat_image_hidden_dir" value="1">
and that's what the HTML looks like too after I update using my method so I don't understand what's going on.
The code for my accessory looks like:
$this->EE->cp->add_to_head('
<script src="/themes/third_party/category_image_file_browser/js/jquery.easing.min.js"></script>
<script src="/themes/third_party/category_image_file_browser/js/jqueryFileTree.js"></script>
<link rel="stylesheet" href="/themes/third_party/category_image_file_browser/css/jqueryFileTree.css">
<script>
$(document).ready( function() {
function copy_file_path(file) {
var newpath = file.replace("../images/", "");
$("[name=cat_image_hidden]").val(newpath);
}
$("[name=cat_image_hidden_dir]").val("1");
$(".category_field .no_file select,.category_field .modifiers.js_show p,.category_field .file_set.js_hide .filename,.category_field .file_set.js_hide .sub_filename").hide();
$(".category_field .file_set.js_hide").show();
$(".category_field .modifiers.js_show").fileTree({ root: "../images/", script: "/themes/third_party/category_image_file_browser/connectors/jqueryFileTree.php" }, function(file) {
copy_file_path(file);
});
});
</script>
');
I've looked through the HTML and don't see any other form inputs I should be updating, but I've obviously missed something.
Anyone know what that is?
For reference, I'm using http://www.abeautifulsite.net/blog/2008/03/jquery-file-tree/ for the file browser. This part, selecting the value, all works fine; it's only saving to EE that I'm having trouble with.