Skip to content

Instantly share code, notes, and snippets.

@pwolanin
Created July 27, 2013 15:43
Show Gist options
  • Save pwolanin/6095209 to your computer and use it in GitHub Desktop.
Save pwolanin/6095209 to your computer and use it in GitHub Desktop.
/**
* Provides a search plugin manager.
*/
class SearchPluginManager extends DefaultPluginManager {
/**
* {@inheritdoc}
*/
public function __construct(\Traversable $namespaces) {
$annotation_namespaces = array('Drupal\search\Annotation' => $namespaces['Drupal\search']);
parent::__construct('Plugin/Search', $namespaces, $annotation_namespaces, 'Drupal\search\Annotation\SearchPlugin');
}
/**
* {@inheritdoc}
*/
public function processDefinition(&$definition, $plugin_id) {
parent::processDefinition($definition, $plugin_id);
// Fill in the provider as default values for missing keys.
$definition += array(
'title' => $definition['provider'],
'path' => $definition['provider'],
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment