You are here

public static function EntityOwnerTrait::getOwnerFieldDefinition in CRM Core 8

Same name and namespace in other branches
  1. 8.2 src/EntityOwnerTrait.php \Drupal\crm_core\EntityOwnerTrait::getOwnerFieldDefinition()

Defines 'uid' base field definition.

Return value

\Drupal\Core\Field\BaseFieldDefinition A field definition object.

File

src/EntityOwnerTrait.php, line 23

Class

EntityOwnerTrait
Trait implementing the various methods defined in EntityOwnerInterface.

Namespace

Drupal\crm_core

Code

public static function getOwnerFieldDefinition() {
  return BaseFieldDefinition::create('entity_reference')
    ->setLabel(t('Owner'))
    ->setRevisionable(TRUE)
    ->setSetting('target_type', 'user')
    ->setDefaultValueCallback('Drupal\\crm_core\\EntityOwnerTrait::getDefaultAuthorId');
}