You are here

function RealisticDummyContentAttribute::ChangeFromFiles in Realistic Dummy Content 7

Given candidate files, change the value of this attribute based on one of them.

Parameters

$files: An array of files.

1 call to RealisticDummyContentAttribute::ChangeFromFiles()
RealisticDummyContentAttribute::Change in api/includes/RealisticDummyContentAttribute.inc
Changes this attribute by looking for data in files.

File

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

Class

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

Code

function ChangeFromFiles($files) {
  $value = $this
    ->ValueFromFiles($files);
  if ($value === NULL) {

    // NULL indicates we could not find a value with which to replace the
    // current value. The value can still be '', or FALSE, etc.
    return;
  }
  $entity = $this
    ->GetEntity()
    ->GetEntity();
  $entity->{$this
    ->GetName()} = $value;
  $this
    ->GetEntity()
    ->SetEntity($entity);
}