I don't use Safecracker very often, but I'm working on an EE 2.6.1 project where {field:assets_field} is magically bringing the Assets file manager (and uploads) to the front end.

I see that this involves adding a JSON array to the page which configures the field, but I'm not sure if there's a good (or deliberate/preferred) way to get in there and mess with it before the user interacts with the field.

In specific templates where the thumbnail view is worthless without the filename (like a folder of PDFs), I'd like to preselect the list view. In many templates, I'd like to preselect a specific folder – like one belonging to a certain user – not because the person shouldn't see any other files, but because it'd be more convenient if they didn't have to browse through the file tree.

Is it possible to preselect a folder and/or view type?

1 Answer 1


that's tricky. How Assets determines the view is set in your browser's localStorage.

The setting string is stored there under PT_Assets_field_id_XX, where XX is the id of the field and you'll have to modify that so that "view" is set to list.

  • Thanks Andris – barring some secret API, this is exactly what I needed to know. Cheers!
    – Matt Stein
    Sep 19, 2013 at 17:08
  • Matt, the secret API is for the secret friends club! Don't talk about it in public! :) Sep 20, 2013 at 6:23
  • [private comment posted ultra-privately]
    – Matt Stein
    Sep 20, 2013 at 17:01
  • Matt, we changed how this is stored in Assets 2.2. We are now storing the file view for each top level source per context, where context is either filemanager or sheet. In you case it would be sheet. You should look at localStorage.PT_Assets_Source_State_sheet value now. The keys used there are top level folder ids. This applies if you update to Assets 2.2. Sorry for inconvenience, Matt.. Oct 9, 2013 at 21:04
  • Inconvenience? It's super convenient that you bothered to update this thread, and I appreciate it. Anyway, hacks are always at risk of breaking so no worries here. Thanks again!
    – Matt Stein
    Oct 9, 2013 at 23:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.