You are here

function panels_renderer_editor::ajax_style in Panels 6.3

Same name and namespace in other branches
  1. 7.3 plugins/display_renderers/panels_renderer_editor.class.php \panels_renderer_editor::ajax_style()

AJAX Router function for style owned AJAX calls.

Styles like the stylizer need AJAX callbacks of their own. This allows the system to figure out which style is being referenced, load it, and execute the callback.

This allows those layouts to simply declare their callbacks and use them using $this->get_url('style', $command, $type, $pid).

File

plugins/display_renderers/panels_renderer_editor.class.php, line 1399
Class file to control the main Panels editor.

Class

panels_renderer_editor
@file Class file to control the main Panels editor.

Code

function ajax_style() {
  $args = func_get_args();
  if (count($args) < 3) {
    return MENU_NOT_FOUND;
  }
  $command = array_shift($args);
  $type = array_shift($args);
  $pid = array_shift($args);
  $info = $this
    ->get_style($type, $pid);
  $style = $info[0];
  $conf =& $info[1];
  if (empty($style['ajax'][$command]) || !function_exists($style['ajax'][$command])) {
    return MENU_NOT_FOUND;
  }

  // Make sure the this is always available to the called functions.
  $args = array_merge(array(
    &$this,
    $style,
    &$conf,
    $type,
    $pid,
  ), $args);
  return call_user_func_array($style['ajax'][$command], $args);
}