public function Profile::__construct in Profile 2 7
Same name and namespace in other branches
- 7.2 profile2.module \Profile::__construct()
Overrides Entity::__construct
File
- ./
profile2.module, line 912 - Support for configurable user profiles.
Class
- Profile
- The class used for profile entities.
Code
public function __construct($values = array()) {
if (isset($values['user'])) {
$this
->setUser($values['user']);
unset($values['user']);
}
if (isset($values['type']) && is_object($values['type'])) {
$values['type'] = $values['type']->type;
}
if (!isset($values['label']) && isset($values['type']) && ($type = profile2_get_types($values['type']))) {
// Initialize the label with the type label, so newly created profiles
// have that as interim label.
$values['label'] = $type->label;
}
parent::__construct($values, 'profile2');
}