public function CerProfile2Field::createInnerEntity in Corresponding Entity References 7.3
Implements CerEntityContainerInterface::createInnerEntity().
Overrides CerEntityContainerInterface::createInnerEntity
File
- extensions/
cer_profile2/ profile2.inc, line 57 - Contains a CER field plugin for referencing Profile2 entities. These references are not actually fields at all, so this plugin is really more of a bridge to trick CER into thinking that Profile2 is a reference field.
Class
- CerProfile2Field
- @file Contains a CER field plugin for referencing Profile2 entities. These references are not actually fields at all, so this plugin is really more of a bridge to trick CER into thinking that Profile2 is a reference field.
Code
public function createInnerEntity(EntityDrupalWrapper $owner) {
$init = array(
'user' => $owner
->value(),
'type' => $this->profileType,
);
// Create a blank profile for this user, and save it. The "reference" is implied
// by the existence of the profile.
$profile = profile2_create($init);
$profile
->save();
return $profile;
}