protected function FarmAssetProcessor::newEntity in farmOS 7
Creates a new farm asset in memory and returns it.
File
- modules/
farm/ farm_asset/ includes/ feeds/ plugins/ FarmAssetProcessor.inc, line 31 - Class definition of FarmAssetProcessor.
Class
- FarmAssetProcessor
- Creates farm assets from feed items.
Code
protected function newEntity(FeedsSource $source) {
// If an author is not defined, set the author to the current user.
$uid = $this->config['author'];
global $user;
if (empty($uid) && !empty($user->uid)) {
$uid = $user->uid;
}
// Assemble and return the entity.
$values = array(
'type' => $this
->bundle(),
'created' => REQUEST_TIME,
'changed' => REQUEST_TIME,
'uid' => $uid,
'is_new' => TRUE,
);
return entity_create('farm_asset', $values);
}