You are here

function RealisticDummyContentAttribute::ValueFromFile in Realistic Dummy Content 7

Given a RealisticDummyContentFileGroup object, get structured property if extentions ok.

The structured property can then be added to the entity.

For example, sometimes the appropriate property is array('value' => 'abc', 'text_format' => 'filtered_html'); other times is it just a string. Subclasses will determine what to do with the contents from the file.

Parameters

$file: The actual file object.

Return value

In case of an error or if the value does not apply or is empty, return NULL; otherwise returns structured data to be added to the entity object.

1 call to RealisticDummyContentAttribute::ValueFromFile()
RealisticDummyContentAttribute::ValueFromFiles in api/includes/RealisticDummyContentAttribute.inc
Given a list of files, return a value from one of them.

File

api/includes/RealisticDummyContentAttribute.inc, line 197
Define RealisticDummyContentAttribute autoload class.

Class

RealisticDummyContentAttribute
Represents either a field or a property for an entity.

Code

function ValueFromFile($file) {
  try {
    if (in_array($file
      ->GetRadicalExtension(), $this
      ->GetExtensions())) {
      return $this
        ->ValueFromFile_($file);
    }
  } catch (Exception $e) {
    return NULL;
  }
}