You are here

public function SocialContentFlickr::prepareRow in Social Content 7.2

Do the uploads and attach expected fields to a row about to be imported.

Overrides SocialContent::prepareRow

File

modules/flickr/social_content_flickr.class.inc, line 217
Social Content Flickr class.

Class

SocialContentFlickr
@file Social Content Flickr class.

Code

public function prepareRow($row) {
  $mappings = $this
    ->getFieldMappings();
  if (parent::prepareRow($row) === FALSE) {
    return FALSE;
  }
  $row->caption = !empty($row->description->_content) ? $row->description->_content : '';
  $row->created = $row->dateupload;
  $row->user_name = $row->ownername;
  $row->user_id = $row->owner;
  $row->user_link = 'https://www.flickr.com/photos/' . $row->user_id;
  $row->link = $row->user_link . '/' . $row->id;
  $image_url = $this
    ->getImageUrl($row);
  if ($image_url) {
    $picture = $this
      ->saveExternalFile($image_url, $mappings['picture']);
    $row->picture = $picture ? $picture : NULL;
  }
  return TRUE;
}