Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
While i was working on a view that display the files according to the file schema type(private/public) i notice that it not exists. I wrote a patch that contain the filter criteria by the file schema type.
Comments
Comment #1
RoySegall CreditAttribution: RoySegall commentedComment #2
ParisLiakos CreditAttribution: ParisLiakos commentedTypos
Comment #3
RoySegall CreditAttribution: RoySegall commentedComment #4
Devin Carlson CreditAttribution: Devin Carlson commented#3 looks good but it seems like it is hardcoded to either public or private stream wrappers?
I'd suggest using file_get_stream_wrappers() to enable filtering by other schemes like those provided by projects such as Remote stream wrapper and AmazonS3.
Comment #5
RoySegall CreditAttribution: RoySegall commentedNot stream wrappers - Schema type. As far as i know, in drupal there is two types of file schema: public and private.
Comment #6
Dave ReidThe schema type of the file is the stream wrapper used, so Devin is correct this needs to support everything in file_get_stream_wrappers() that also has the 'visible' flag. There should be an file entity API function that can already be used to get the visible stream wrappers.
Comment #7
RoySegall CreditAttribution: RoySegall commentedComment #8
agoradesign CreditAttribution: agoradesign commentedThere's a typo in the filename and also in the class name: views_handler_filter_scehma_type.inc (scehma)
Comment #9
agoradesign CreditAttribution: agoradesign commentedI've tried out this filter. It basically works, but lacks of some basic configuration options:
There is no operator to choose. At least the possibility to reverse the filter in order to exclude a specific scheme would be nice. Now, if you have a couple of filters and want to exclude only one of them, you would have to insert multiple schema filters for all the remaining schemas in an Views filter group with an OR condition - at least theoratically. Because that didn't work for me and resulted in an empty search result.
I ended up in removing this filter and using a filter on the file's path with the condition set, that the path should not start with "private://" and it worked better for me
Comment #10
RoySegall CreditAttribution: RoySegall commentedRe rolling and fix typos.
Comment #11
aaron CreditAttribution: aaron commentedThis is a good start. However we need to address the concerns about the operator's in #9. Additionally, it does not work if you expose the filter. Lastly, we need to change the administrative description which currently reads "Filter files by private/public schema." I am not certain offhand what would be better, but an example would be if you are using, for instance, the media youtube module to add a youtube schema. Maybe we can have something like "filter files by their schema, such as private/public." Lastly lastly, I noticed that it allows you to select temporary files and I am not certain if those would be considered visible. And finally (for real), I think it would be better to have checkboxes to allow for multiple selections.
Comment #12
MPetrovic CreditAttribution: MPetrovic commentedThis filter wasn't working for us either. Here's a new version that's more flexible.
Comment #13
MPetrovic CreditAttribution: MPetrovic commentedComment #14
MPetrovic CreditAttribution: MPetrovic commentedMissed a couple things
Comment #16
jorisdejong CreditAttribution: jorisdejong commentedHi there,
I have recreated MPetrovic's #14 patch against the latest 7.x-2.x branch. Let's see if it gets passed by testbot.
Comment #17
ParisLiakos CreditAttribution: ParisLiakos commentedComment #18
RoySegall CreditAttribution: RoySegall commentedMinor coding standart:
=> $statements[] = 'uri ' . $nope . 'LIKE \'' . db_like($schema) . '://%\'';
Comment #19
jorisdejong CreditAttribution: jorisdejong commentedMade this small change in code, including your coding standard fix :)
Comment #20
jorisdejong CreditAttribution: jorisdejong commentedComment #21
aaron CreditAttribution: aaron commented19: filter-by-file-schema-type-1881356-19.patch queued for re-testing.
Comment #22
aaron CreditAttribution: aaron commentedWorks as advertised. Congratulations!
Comment #24
aaron CreditAttribution: aaron commentedCommitted to http://drupalcode.org/project/file_entity.git/commit/929a939
Comment #26
PascalAnimateur CreditAttribution: PascalAnimateur commentedIs the Schema type also exposed as a field, or only as a filter criteria?