You are here

function hook_mpac_selection_handlers in Multi-path autocomplete 8

Alters the list of selection handlers for a given type.

Called by mpac_get_selection_handlers() to allow modules to alter the list of selection handler for a single selection type (i.e. "path").

Parameters

array $handlers: Associative array of selection plugins keyed by the plugin ID.

string $type: Name of selection type (i.e. "path").

File

./mpac.api.php, line 40
Hooks provided by the Multi-path autocomplete module.

Code

function hook_mpac_selection_handlers(&$handlers, $type) {
  if ($type == 'path' && isset($handlers['node'])) {

    // Load instance of custom plugin.
    $plugin = \Drupal::getContainer()
      ->get('plugin.manager.mpac.selection')
      ->createInstance('test');

    // Replace node selection handler with custom implementation.
    $handlers['node'] = $plugin;
  }
}