You are here

public function DiffBuilderManager::createInstanceForFieldDefinition in Diff 8

Creates a plugin instance for a field definition.

Creates the instance based on the selected plugin for the field.

Parameters

\Drupal\Core\Field\FieldDefinitionInterface $field_definition: The field definition.

Return value

\Drupal\diff\FieldDiffBuilderInterface|null The plugin instance, NULL if none.

File

src/DiffBuilderManager.php, line 126

Class

DiffBuilderManager
Plugin type manager for field diff builders.

Namespace

Drupal\diff

Code

public function createInstanceForFieldDefinition(FieldDefinitionInterface $field_definition) {
  $selected_plugin = $this
    ->getSelectedPluginForFieldStorageDefinition($field_definition
    ->getFieldStorageDefinition());
  if ($selected_plugin['type'] != 'hidden') {
    return $this
      ->createInstance($selected_plugin['type'], $selected_plugin['settings']);
  }
  return NULL;
}