You are here

function RealisticDummyContentImageField::ValueFromFile_ in Realistic Dummy Content 7

Given a RealisticDummyContentFileGroup object, get a structured property

This function is not meant to called directly; rather, call ValueFromFile(). This function must be overriden by subclasses.

Parameters

$file: An object of type RealisticDummyContentFileGroup.

Return value

Returns structured data to be added to the entity object, or NULL if such data can't be creatd.

Throws

Exception.

Overrides RealisticDummyContentAttribute::ValueFromFile_

File

api/includes/RealisticDummyContentImageField.inc, line 23
Define RealisticDummyContentImageField autoload class.

Class

RealisticDummyContentImageField
Field modifier for image fields.

Code

function ValueFromFile_($file) {
  if (!$file
    ->Value()) {
    return NULL;
  }
  $return = NULL;
  $file = $this
    ->ImageSave($file);
  if ($file) {
    $return = array(
      LANGUAGE_NONE => array(
        (array) $file,
      ),
    );
  }
  return $return;
}