You are here

function highcharttable_contextual_link in HighchartTable 7

Menu callback for highcharttable/contextual-link

Parameters

string $operation ($arg0): The operation to perform, one of 'insert', 'delete'. 'configure' is obsolete as this operation can be done via a direct link.

string $chart_type ($arg1): The chart type, one of 'column', 'line', 'spline', 'area', 'pie'. Defaults to 'column'.

string $arg2: Optional argument, not used

string $arg3: Optional argument, not used

1 string reference to 'highcharttable_contextual_link'
highcharttable_menu in ./highcharttable.module
Implements hook_menu().

File

./highcharttable.module, line 185
highcharttable.module

Code

function highcharttable_contextual_link($operation = NULL, $chart_type = NULL, $arg2 = NULL, $arg3 = NULL) {
  $decorations = variable_get('highcharttable_decorations', array());
  $page = filter_input(INPUT_GET, 'destination');
  $url_options = array(
    'query' => array(
      'destination' => $page,
    ),
  );
  switch ($operation) {
    case 'insert':
      highcharttable_add_decoration($page, $chart_type, $decorations);
      break;
    case 'delete':
      highcharttable_remove_page_from_decorations($page, $decorations);
      break;
    default:

      // Not used. As there are no actions required for 'configure', link to
      // this page directly, rather than using this function.
      drupal_goto('admin/config/content/highcharttable', $url_options);
  }

  // Make sure to save with keys that are numeric, consecutive and start at 0.
  variable_set('highcharttable_decorations', array_values($decorations));

  // Having created/deleted the chart decoration we return where we came from.
  drupal_goto($page, $url_options);
}