You are here

public static function VideoEmbedField::createInstance in Video Embed Field 8

Same name and namespace in other branches
  1. 8.2 src/Plugin/Field/FieldType/VideoEmbedField.php \Drupal\video_embed_field\Plugin\Field\FieldType\VideoEmbedField::createInstance()

Constructs a TypedData object given its definition and context.

@todo When \Drupal\Core\Config\TypedConfigManager has been fixed to use class-based definitions, type-hint $definition to DataDefinitionInterface. https://www.drupal.org/node/1928868

Parameters

\Drupal\Core\TypedData\DataDefinitionInterface $definition: The data definition.

string|null $name: (optional) The name of the created property, or NULL if it is the root of a typed data tree. Defaults to NULL.

\Drupal\Core\TypedData\TraversableTypedDataInterface $parent: (optional) The parent object of the data property, or NULL if it is the root of a typed data tree. Defaults to NULL.

Overrides TypedData::createInstance

See also

\Drupal\Core\TypedData\TypedDataManager::create()

File

src/Plugin/Field/FieldType/VideoEmbedField.php, line 44

Class

VideoEmbedField
Plugin implementation of the video_embed_field field type.

Namespace

Drupal\video_embed_field\Plugin\Field\FieldType

Code

public static function createInstance($definition, $name = NULL, TraversableTypedDataInterface $parent = NULL) {
  $provider_manager = \Drupal::service('video_embed_field.provider_manager');
  return new static($definition, $name, $parent, $provider_manager);
}