WordPress.org

Ready to get started?Download WordPress

Forums

Debug Bar
Small change request for output HTML in the UI (1 post)

  1. Pete Nelson
    Member
    Posted 1 year ago #

    I'm working on a plugin that adds allows developers to add their own custom tabs to the Debug Bar. Because the HTML generated by the UI for each tab uses the class name as the part of ID, if I add my class to the $panels array more than once, the debug bar's jquery code can't tell which unique menu target to display. For example, with two instances of my class, it's generating something like this:

    <a id="debug-menu-link-GunGeekATX_DebugBarExtender" href="#debug-menu-target-GunGeekATX_DebugBarExtender" />
    <a id="debug-menu-link-GunGeekATX_DebugBarExtender" href="#debug-menu-target-GunGeekATX_DebugBarExtender" />

    If the Debug Bar plugin can be modified to make the IDs unique, the the jquery code will display the correct tabs. Modifying the debug-bar.php file, render() method's two foreach loops by adding the $class_loop should do it. Snippet:

    $class_loop = 0;
    $current = ' current';
    foreach ( $this->panels as $panel ) :
    	$class = get_class( $panel ) . $class_loop;
    	$class_loop++;
    // etc, reset $class_loop to 0 when done

    It will then output, for example:

    <a id="debug-menu-link-GunGeekATX_DebugBarExtender7" href="#debug-menu-target-GunGeekATX_DebugBarExtender7" />
    <a id="debug-menu-link-GunGeekATX_DebugBarExtender8" href="#debug-menu-target-GunGeekATX_DebugBarExtender8" />

    http://wordpress.org/extend/plugins/debug-bar/

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.