public function CerProfile2Field::__construct in Corresponding Entity References 7.3
@override CerField::__construct().
Overrides CerField::__construct
File
- extensions/
cer_profile2/ profile2.inc, line 17 - 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 __construct(array $plugin) {
$this->plugin = $plugin;
list($this->entityType, $this->bundle, $this->name) = explode(':', $plugin['identifier']);
$info = entity_get_info($this->entityType);
// These "fields" can only be instantiated on user accounts, which are
// normally not bundleable. However, there could be a module in the wild
// which makes accounts bundleable, so let's not be presumptuous here.
$this->isBundleable = (bool) $info['entity keys']['bundle'];
$this->entityTypeLabel = $info['label'];
$this->bundleLabel = $info['bundles'][$this->bundle]['label'];
// An account can only have one profile of this type.
$this->cardinality = 1;
$this->fieldTypeLabel = t('Profile');
// Load the Profile2 type information
$this->profileType = profile2_get_types(subStr($this->name, 8));
$this->label = $this->profileType->label;
}