Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Background
Current the flickr field asks for 3 different user inputs:
Item Type
Id
and User Id.
Motivation
- All of this information can be supplied from a simplified, unique identifier - URL
- Even when I know the values I want in the fields, it's cumbersome to copy and paste them from the URL, or god forbid I have to go search for my nsid.
- The flickr URL contains enough information for flickr API to retrieve all the necessary info for the asset without any additional input from the end user
- Regardless of whether these 3 fields are stored in the database, exposing the user to the underlying schema is confusing.
Solution
Only collect the asset URL from the user (set URL or photo URL), parse the photo or set id from it.
In this patch
- in flickr.inc: added flickr_get_info_by_url(). Given the URL to a flickr asset (set or photo), return info about that asset.
- in flickrfield.module: Update flickrfield_process() to provide a single text field for user input.
- in flickrfield.module: Add flickrfield_field() with validate and presave operations to populate the existing columns
Note that flickrfield schema is not changed by this patch.
Comment | File | Size | Author |
---|---|---|---|
#12 | flickrfield_by_url_for_D7-1170010-12.patch | 6.13 KB | lolandese |
#11 | flickrfield_by_url_for_D7-1170010-11.patch | 11.42 KB | lolandese |
#7 | flickrfield_by_url-1170010-7.patch | 8.78 KB | lolandese |
#3 | flickrfield-by-url-1170010-3.patch | 5.95 KB | AaronBauman |
#2 | flickrfield-by-url-1170010-dev.patch | 5.96 KB | AaronBauman |
Comments
Comment #1
AaronBaumanComment #2
AaronBaumanRe-rolled at dev.
Comment #3
AaronBaumanmis-typed array indexes - values were being lost on node edit.
Comment #5
chaloum CreditAttribution: chaloum commentedDo you have this patch of the D7 version of flickr?
Comment #6
AaronBaumanNo, I switched to the filefield_sources, which is more suited to my simple use case.
Comment #7
lolandese CreditAttribution: lolandese commentedThanks for this. Apologies for the late reaction.
Rerolled against the current dev. With some minor changes it seems to work as expected.
Comment #8
lolandese CreditAttribution: lolandese commentedCommitted with attribution. See http://drupalcode.org/project/flickr.git/commitdiff/ce9c349.
Thanks.
Comment #9
lolandese CreditAttribution: lolandese commentedTo port to D7.
Comment #10
lolandese CreditAttribution: lolandese commentedBetter title and changed version to D7.
Comment #11
lolandese CreditAttribution: lolandese commentedAttached patch for now only adds the unified URL field and validates it. No form submission processing yet.
Thanks.
Comment #12
lolandese CreditAttribution: lolandese commentedPlain reroll of previous patch against latest dev. Nothing else.
The field does not seem to get validated nor saved.
Comment #13
lolandese CreditAttribution: lolandese commentedComment #14
lolandese CreditAttribution: lolandese commentedMeanwhile the provided example at https://www.drupal.org/node/2416565#comment-9578885 can be used by those that are looking to simplify the Flickr Field.
Comment #15
lolandese CreditAttribution: lolandese commented