You are here

public function BrightcoveCustomField::setType in Brightcove Video Connect 8

Same name and namespace in other branches
  1. 8.2 src/Entity/BrightcoveCustomField.php \Drupal\brightcove\Entity\BrightcoveCustomField::setType()
  2. 3.x src/Entity/BrightcoveCustomField.php \Drupal\brightcove\Entity\BrightcoveCustomField::setType()

Sets the type of the field.

Parameters

string $type: The type of the field, it can be either 'enum' or 'string'.

Return value

\Drupal\brightcove\BrightcoveCustomFieldInterface The called Brightcove Custom Field.

Overrides BrightcoveCustomFieldInterface::setType

File

src/Entity/BrightcoveCustomField.php, line 95

Class

BrightcoveCustomField
Defines the Brightcove Custom Field.

Namespace

Drupal\brightcove\Entity

Code

public function setType($type) {
  if (!in_array($type, [
    self::TYPE_STRING,
    self::TYPE_ENUM,
  ])) {
    throw new \Exception(t('Invalid field type.'));
  }
  return $this
    ->set('type', $type);
}