? ? Pending

User tests: Successful: Unsuccessful:

avatar mbabker
mbabker
20 Aug 2016

Summary of Changes

Allow extensions to register a callable function to be triggered when the debug console is rendered. This gives a hook to allow extensions to add data to the console.

Testing Instructions

Somewhere after the debug plugin is instantiated, add the following code:

// Only register when in debug mode and the debug plugin is enabled
if (JDEBUG && JPluginHelper::isEnabled('system', 'debug'))
{
    PlgSystemDebug::addDisplayCallback('test', function () { return 'Testing new debug console feature!' });
}

Now when viewing the page and you have debug mode and the debug plugin enabled, you should have a new section on the console with a title PLG_DEBUG_TEST (this is a translatable key) and opening the section should have the text from our anonymous function used for testing here.

Documentation Changes Required

Document the new API methods:

  • PlgSystemDebug::addDisplayCallback() which takes two parameters:
    • $name is the name of the callable function, it's used as an identifier for the various markup elements and to create the language key to translate the title
    • $callable is a valid callable function (anything which passes PHP 5.4's callable typehint or the is_callable() method will suffice here)
  • PlgSystemDebug::removeDisplayCallback() which takes one parameter:
    • $name is the name of the callable function to be removed

Document the callable's functionality:

  • The callback function receives no parameters from the debug plugin and is expected to return a string (this should be HTML); this string is what is rendered in the debug console

Document how to translate the title:

  • The language key is a compound key, JText::_('PLG_DEBUG_' . strtoupper($name)), so the name you give your callable should be in a format allowed with the language parser
  • Add this key to your language files, for example with the above code snippet we should have a PLG_DEBUG_TEST="Testing New Feature" key somewhere
avatar joomla-cms-bot joomla-cms-bot - change - 20 Aug 2016
Category Plugins Front End
avatar mbabker mbabker - open - 20 Aug 2016
avatar mbabker mbabker - change - 20 Aug 2016
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 20 Aug 2016
Labels Added: ?
avatar mbabker mbabker - change - 20 Aug 2016
The description was changed
avatar mbabker mbabker - edited - 20 Aug 2016
avatar andrepereiradasilva andrepereiradasilva - test_item - 21 Aug 2016 - Tested successfully
avatar andrepereiradasilva
andrepereiradasilva - comment - 21 Aug 2016

I have tested this item successfully on f942e74

works as described. nice feature!


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/11700.

avatar jeckodevelopment jeckodevelopment - change - 22 Aug 2016
Labels Added: ? ?
avatar brianteeman brianteeman - change - 23 Aug 2016
Labels Removed: ?
avatar truptikagathara truptikagathara - test_item - 24 Aug 2016 - Tested successfully
avatar truptikagathara
truptikagathara - comment - 24 Aug 2016

I have tested this item successfully on f942e74


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/11700.

avatar zero-24 zero-24 - change - 24 Aug 2016
Status Pending Ready to Commit
avatar zero-24
zero-24 - comment - 24 Aug 2016

RTC


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/11700.

avatar joomla-cms-bot joomla-cms-bot - change - 24 Aug 2016
Labels Added: ?
avatar wilsonge
wilsonge - comment - 3 Sep 2016

Merged with a3808b3

avatar wilsonge wilsonge - close - 3 Sep 2016
avatar joomla-cms-bot joomla-cms-bot - close - 3 Sep 2016
avatar wilsonge wilsonge - change - 3 Sep 2016
Status Ready to Commit Closed
Closed_Date 0000-00-00 00:00:00 2016-09-03 11:09:28
Closed_By wilsonge
avatar joomla-cms-bot joomla-cms-bot - change - 3 Sep 2016
Labels Removed: ?

Add a Comment

Login with GitHub to post a comment