public function Individual::getPrimaryField in CRM Core 8
Same name and namespace in other branches
- 8.3 modules/crm_core_contact/src/Entity/Individual.php \Drupal\crm_core_contact\Entity\Individual::getPrimaryField()
- 8.2 modules/crm_core_contact/src/Entity/Individual.php \Drupal\crm_core_contact\Entity\Individual::getPrimaryField()
Gets the primary field.
Parameters
string $field: The primary field name.
Return value
\Drupal\Core\Field\FieldItemListInterface|\Drupal\Core\TypedData\TypedDataInterface The primary field property object.
Throws
\InvalidArgumentException If no primary field is configured. If the configured primary field does not exist.
3 calls to Individual::getPrimaryField()
- Individual::getPrimaryAddress in modules/
crm_core_contact/ src/ Entity/ Individual.php - Gets the primary address.
- Individual::getPrimaryEmail in modules/
crm_core_contact/ src/ Entity/ Individual.php - Gets the primary email.
- Individual::getPrimaryPhone in modules/
crm_core_contact/ src/ Entity/ Individual.php - Gets the primary phone.
File
- modules/
crm_core_contact/ src/ Entity/ Individual.php, line 158
Class
- Individual
- CRM Individual Entity Class.
Namespace
Drupal\crm_core_contact\EntityCode
public function getPrimaryField($field) {
$type = $this
->get('type')->entity;
$name = empty($type->primary_fields[$field]) ? '' : $type->primary_fields[$field];
return $this
->get($name);
}