You are here

public function TcaPluginManager::createInstanceByEntityType in Token Content Access 2.0.x

Same name and namespace in other branches
  1. 8 src/Plugin/TcaPluginManager.php \Drupal\tca\Plugin\TcaPluginManager::createInstanceByEntityType()

Create an instance of the first plugin found with string id $entity_type.

Create an instance of the first plugin found supporting the entity type with string id $entity_type.

Parameters

string $entity_type: The string ID of the entity type.

Return value

Drupal\tca\Plugin\TcaPluginInterface The plugin.

File

src/Plugin/TcaPluginManager.php, line 62

Class

TcaPluginManager
Provides the TCA plugin manager.

Namespace

Drupal\tca\Plugin

Code

public function createInstanceByEntityType($entity_type) {
  $plugin_ids = array_keys($this
    ->loadDefinitionsByEntityType($entity_type));
  return $plugin_ids ? $this
    ->createInstance($plugin_ids[0]) : NULL;
}