You are here

function hook_taxonomy_display_plugins_alter in Taxonomy display 7

Alter plugins list used by taxonomy_display.

Parameters

array $plugins:

Return value

void

See also

hook_taxonomy_display_plugins()

taxonomy_display_plugins()

1 invocation of hook_taxonomy_display_plugins_alter()
taxonomy_display_plugins in ./taxonomy_display.module
Retrieve an array of Taxonomy Display plugins.

File

./taxonomy_display.api.php, line 70
Hooks provided by the taxonomy_display module.

Code

function hook_taxonomy_display_plugins_alter(&$plugins) {

  // Hijack taxonomy_display's Views plugin.
  if (isset($plugins['associated']['TaxonomyDisplayAssociatedDisplayHandlerViews'])) {

    // Remove this from even being an option to users!
    unset($plugins['associated']['TaxonomyDisplayAssociatedDisplayHandlerViews']);

    // Now hijack all existing taxonomy_display settings to use my plugin that
    // previously using taxonomy_display's Views plugin.
    $count = (bool) db_update('taxonomy_display')
      ->fields(array(
      'associated_display_plugin',
      'MyViewsPluginHandler',
    ))
      ->condition('associated_display_plugin', 'TaxonomyDisplayAssociatedDisplayHandlerViews')
      ->execute();

    // Note that the plugin handler 'MyViewsPluginHandler' in the db_update()
    // should be defined in hook_taxonomy_display_plugins() to allow other
    // modules to overwrite it if desired.
  }
}