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.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

AaronBauman’s picture

AaronBauman’s picture

Re-rolled at dev.

AaronBauman’s picture

mis-typed array indexes - values were being lost on node edit.

chaloum’s picture

Do you have this patch of the D7 version of flickr?

AaronBauman’s picture

No, I switched to the filefield_sources, which is more suited to my simple use case.

lolandese’s picture

Issue summary: View changes
FileSize
8.78 KB

Thanks for this. Apologies for the late reaction.

Rerolled against the current dev. With some minor changes it seems to work as expected.

lolandese’s picture

Status: Needs review » Fixed

Committed with attribution. See http://drupalcode.org/project/flickr.git/commitdiff/ce9c349.

Thanks.

lolandese’s picture

Status: Fixed » Patch (to be ported)

To port to D7.

lolandese’s picture

Title: Make it more user-friendly » Parse the user id (nsid) and photo/set id from the Flickr page URL
Version: 6.x-1.x-dev » 7.x-1.x-dev

Better title and changed version to D7.

lolandese’s picture

Status: Patch (to be ported) » Needs work
FileSize
11.42 KB

Attached patch for now only adds the unified URL field and validates it. No form submission processing yet.

Thanks.

lolandese’s picture

Plain reroll of previous patch against latest dev. Nothing else.

The field does not seem to get validated nor saved.

lolandese’s picture

Component: flickr_field » flickrfield
lolandese’s picture

Meanwhile 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.

lolandese’s picture

Issue tags: +advanced