You are here

protected function crumbs_PluginSystem_PluginEngine::findAll in Crumbs, the Breadcrumbs suite 7.2

Invoke all relevant plugins to find title or parent for a given path.

Parameters

crumbs_PluginSystem_PluginMethodIterator $iterator:

array $args: Parameter values to pass to plugin methods.

bool $processFindParent:

Return value

mixed|null

2 calls to crumbs_PluginSystem_PluginEngine::findAll()
crumbs_PluginSystem_PluginEngine::findAllParents in lib/PluginSystem/PluginEngine.php
Invoke all relevant plugins to find all possible parents for a given path.
crumbs_PluginSystem_PluginEngine::findAllTitles in lib/PluginSystem/PluginEngine.php
Invoke all relevant plugins to find all possible titles for a given path.

File

lib/PluginSystem/PluginEngine.php, line 201

Class

crumbs_PluginSystem_PluginEngine

Code

protected function findAll($iterator, $args, $processFindParent = FALSE) {
  $all_candidates = array();

  /**
   * @var string $plugin_key
   * @var crumbs_PluginSystem_PluginMethodIteratorPosition $position
   */
  foreach ($iterator as $plugin_key => $position) {
    if ($position
      ->isMultiPlugin()) {

      // That's a crumbs_MultiPlugin
      $candidates = $position
        ->invokeFinderMethod($args);
      if (empty($candidates)) {
        continue;
      }
      foreach ($candidates as $candidate_key => $candidate) {
        if (!isset($candidate)) {
          continue;
        }
        if ($processFindParent) {
          $candidate = $this
            ->processFindParent($candidate);
          if (!isset($candidate)) {
            continue;
          }
        }
        $all_candidates["{$plugin_key}.{$candidate_key}"] = $candidate;
      }
    }
    else {

      // That's a crumbs_MonoPlugin
      $candidate = $position
        ->invokeFinderMethod($args);
      if (!isset($candidate)) {
        continue;
      }
      if ($processFindParent) {
        $candidate = $this
          ->processFindParent($candidate);
        if (!isset($candidate)) {
          continue;
        }
      }
      $all_candidates[$plugin_key] = $candidate;
    }
  }
  return $all_candidates;
}