Skip to content

Instantly share code, notes, and snippets.

@ckimrie
Last active December 14, 2015 08:48
Show Gist options
  • Save ckimrie/5059997 to your computer and use it in GitHub Desktop.
Save ckimrie/5059997 to your computer and use it in GitHub Desktop.
<?php
//Instead of using ee_debug_toolbar_modify_output as the primary mechanism of adding content to the toolbar,
//we add an additional extension hook for adding content
class Eedt_memory_history_ext {
/**
* Method called for adding toolbar panels
* @param $view Eedt_view
**/
public function ee_debug_toolbar_add_panel($view){
$view->setName('memory_history');
$view->setButtonTitle('Memory History');
$view->setButtonIcon('something.jpg');
$view->setOutput(/* HTML View output */);
$view->addJs('script.js');
$view->addCss('styles.css');
//Adding an ajax calleable method
$view->addAjaxMethod('Eedt_memory_history_ext', 'ajaxData');
return $view;
}
//This function will recieve calls for data from JS
function ajaxData($params){
}
}
//EEDT View Class
class Eedt_view {
//Toolbar button icon
function setName(){}
//Toolbar Button Name
function setButtonTitle(){}
//Toolbar button icon
function setButtonTitle(){}
//Panel HTML
function setOutput(){}
//Panel JS
function addJs(){}
//Panel CSS
function addCss(){}
//Where to inject the HTML
//By default this is going to be in the panel area,
//But this could allow people to inject content before and after the
//toolbar
function setInjectionPoint(/* before, panel, after */){}
//Disable/enable toolbar button (in case they are doing something crazy
//with the above method and a button is not needed)
function setButtonDisplay(/*Bool*/)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment