You are here

public function ImcePluginManager::handleOperation in IMCE 8

Same name and namespace in other branches
  1. 8.2 src/ImcePluginManager.php \Drupal\imce\ImcePluginManager::handleOperation()

Runs an operation handler for the file manager.

File

src/ImcePluginManager.php, line 155

Class

ImcePluginManager
Provides a plugin manager for Imce Plugins.

Namespace

Drupal\imce

Code

public function handleOperation($op, ImceFM $fm) {
  $plugin = $method = FALSE;
  foreach ($this
    ->getDefinitions() as $p => $def) {
    if (!empty($def['operations'][$op])) {
      $plugin = $p;
      $method = $def['operations'][$op];
    }
  }
  if ($method && ($instance = $this
    ->getInstance([
    'id' => $plugin,
  ]))) {
    return $instance
      ->{$method}($fm);
  }

  // Indicate that the operation handler is not found.
  return FALSE;
}