You are here

public function AudienceField::getFieldStorageBaseDefinition in Organic groups 8

Get the field storage config base definition.

Parameters

array $values: Values to override the base definitions.

Return value

array Array that will be used as the base values for FieldStorageConfig::create().

Overrides OgFieldBase::getFieldStorageBaseDefinition

File

src/Plugin/OgFields/AudienceField.php, line 26

Class

AudienceField
Determine to which groups this group content is assigned to.

Namespace

Drupal\og\Plugin\OgFields

Code

public function getFieldStorageBaseDefinition(array $values = []) {
  if ($this
    ->getEntityType() === 'user') {
    throw new \LogicException('OG audience field cannot be added to the User entity type.');
  }
  $values += [
    'cardinality' => FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED,
    'settings' => [
      'target_type' => $this
        ->getEntityType(),
    ],
    'type' => OgGroupAudienceHelperInterface::GROUP_REFERENCE,
  ];
  return parent::getFieldStorageBaseDefinition($values);
}