You are here

function entityreference_get_plugin_manager in Entity reference 8

Returns the PluginManager object for a given entityreference plugin type.

Parameters

string $plugin_type: The plugin type. One of:

  • selection

Return value

Drupal\Component\Plugin\PluginManagerInterface The PluginManager object.

File

./entityreference.module, line 79
Provides a field that can reference other entities.

Code

function entityreference_get_plugin_manager($plugin_type) {
  $plugin_types =& drupal_static(__FUNCTION__, array());
  $classes = array(
    'selection' => 'Drupal\\entityreference\\Plugin\\Type\\Selection\\SelectionPluginManager',
  );
  if (isset($classes[$plugin_type])) {
    if (!isset($plugin_types[$plugin_type])) {
      $plugin_types[$plugin_type] = new $classes[$plugin_type]();
    }
    return $plugin_types[$plugin_type];
  }
}