You are here

public function DataTypePluginManager::getInstances in Search API 8

Returns all known data types.

Return value

\Drupal\search_api\DataType\DataTypeInterface[] An array of data type plugins, keyed by type identifier.

1 call to DataTypePluginManager::getInstances()
DataTypePluginManager::getInstancesOptions in src/DataType/DataTypePluginManager.php
Returns all field data types known by the Search API as an options list.

File

src/DataType/DataTypePluginManager.php, line 89

Class

DataTypePluginManager
Manages data type plugins.

Namespace

Drupal\search_api\DataType

Code

public function getInstances() {
  if (!$this->allCreated) {
    $this->allCreated = TRUE;
    if (!isset($this->dataTypes)) {
      $this->dataTypes = [];
    }
    foreach ($this
      ->getDefinitions() as $plugin_id => $definition) {
      if (class_exists($definition['class']) && empty($this->dataTypes[$plugin_id])) {
        $data_type = $this
          ->createInstance($plugin_id);
        $this->dataTypes[$plugin_id] = $data_type;
      }
    }
  }
  return $this->dataTypes;
}