Not sure why that is happening. Tried to do some debugging to ctools_get_plugin(), and it discovers the own visualization module properly, as expected. However, after having added my own library plugin in a custom module, it doesn't pick up the highcharts plugin anymore. The path is there, ctools_get_plugin processes the google charts one, but seems as though it just ignored the default highcharts one.

Just for more info, my custom module is above Visualization API in the registry. (But didn't try to move it below).

Comments

Niremizov’s picture

I have just created a test module, and add new plugin shows up in settings form as expected. How can I reproduce this behaviour?

Here is code sample of "chart testing" module:

charttest.info

name = Charttest
description = Test Visualization API module.
core = 7.x

dependencies[] = visualization

charttest.module

/**
 * Implements hook_ctools_plugin_directory().
 */
function charttest_ctools_plugin_directory($module, $plugin) {
  if (($module == 'visualization') && ($plugin == 'library')) {
    return 'plugins';
  }
}

plugins/charttest.inc

/**
 * @file
 * Library plugin for Visualization implementing support for
 * Test lib.
 */


class CharttestHandler implements VisualizationHandlerInterface {

  protected $addedJavascript = FALSE;

  public function render($chart_id, $data, $options) {}

  public function postRender() {}

  public function available() {
    return TRUE;
  }

  public function supportedTypes() {
    return array('line', 'column', 'pie', 'map');
  }
}

$plugin = array(
  'name' => 'charttest',
  'label' => t('Chartest'),
  'handler' => new CharttestHandler(),
);

Niremizov’s picture

Status: Active » Postponed (maintainer needs more info)
slv_’s picture

Status: Postponed (maintainer needs more info) » Closed (works as designed)

Thanks for updating.

I think this can be closed. My plugin was extending the default highcharts handler, as I needed to reuse some of the base functionality. Not sure what was going under the hood, but there's something causing the issue when inheriting that handler:

if (module_exists('visualization')) {
  require_once drupal_get_path('module', 'visualization') . '/includes/plugins/highcharts.inc';
  require_once drupal_get_path('module', 'visualization') . '/includes/interfaces.inc';
}

class CustomHighchartsHandler extends  HighchartsHandler {

Removing that, and implementing the visualization interface directly, instead of extending HighchartsHandler, shows all available plugins again in the settings page. Not sure if there's still an issue and it should work extending the default handler, but at least know what the problem was here, and doesn't look like a bug in the surface.

Closing.