protected function BaseFieldDefinition::getFieldItemClass

protected BaseFieldDefinition::getFieldItemClass()

Helper to retrieve the field item class.

@todo: Remove once getClass() adds in defaults. See https://www.drupal.org/node/2116341.

File

core/lib/Drupal/Core/Field/BaseFieldDefinition.php, line 565

Class

BaseFieldDefinition
A class for defining entity fields.

Namespace

Drupal\Core\Field

Code

protected function getFieldItemClass() {
  if ($class = $this->getItemDefinition()->getClass()) {
    return $class;
  }
  else {
    $type_definition = \Drupal::typedDataManager()
      ->getDefinition($this->getItemDefinition()->getDataType());
    return $type_definition['class'];
  }
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Field!BaseFieldDefinition.php/function/BaseFieldDefinition::getFieldItemClass/8.1.x