Skip to main content

Breadcrumbs in WHM interface

Comments

6 comments

  • cPRex Jurassic Moderator
    Hey there! I reached out to the UI team about this one, and confirmed that you can't perform any work with the breadcrumbs in PHP. However, you can do this with the Template Toolkit details here:
    which was pulled from this git here:
    better-postgres4cP/pgupgrade.tmpl at master " Troglodyne-Internet-Widgets/better-postgres4cP Let me know if that helps!
    0
  • jimlongo
    Thanks, that does help, it's where I was thinking I had to go ... but as I askekd earlier, if I'm producing a plugin, "what is this file called, and where does it go so that it's included when the page is rendered?"
    0
  • cPanelThomas
    Howdy, I'm Thomas A. Baugh, developer at cPanel (and the author of the example used above by Rex). While this information is correct, I thought I'd provide a little bit more information in case you do wish to implement this yourself (I have not tested the following). Try to subclass WHM.php. The function `processHeaderStrings` is where we're doing alterations on the header cache which it normally spits out. It is likely "just" a matter of grabbing the output from `parent::processHeaderStrings` in the subclass' version of `processHeaderStrings` and run `str_replace` of your own on the output to insert breadcrumbdata HTML which "looks right" for your plugin in place of ``. Of course, cPanel could be doing this in the parent class; we simply do not do so currently. I can't give you a reason why we don't already do this, as I did not write this part of the product. Presumably so long as the right args for breadcrumbdata is passed in we could construct this fairly straightforwardly. If a case is forthcoming for it, I'll see if I can take a stab at it.
    0
  • cPRex Jurassic Moderator
    This page might also prove helpful as well: Guide to WHM Plugins - Plugin Files
    0
  • jimlongo
    Howdy, I'm Thomas A. Baugh, developer at cPanel (and the author of the example used above by Rex). While this information is correct, I thought I'd provide a little bit more information in case you do wish to implement this yourself (I have not tested the following). Try to subclass WHM.php. The function `processHeaderStrings` is where we're doing alterations on the header cache which it normally spits out. It is likely "just" a matter of grabbing the output from `parent::processHeaderStrings` in the subclass' version of `processHeaderStrings` and run `str_replace` of your own on the output to insert breadcrumbdata HTML which "looks right" for your plugin in place of ``. Of course, cPanel could be doing this in the parent class; we simply do not do so currently. I can't give you a reason why we don't already do this, as I did not write this part of the product. Presumably so long as the right args for breadcrumbdata is passed in we could construct this fairly straightforwardly. If a case is forthcoming for it, I'll see if I can take a stab at it.

    Thanks for your instructions. We got this approach to work, but not without a little difficulty, in that most of the methods in WHM.php are private (like `processHeaderStrings()`) so cannot be called from this new class. And since we cribbed the breadcrumb code from another of your plugins, I have concerns about the maintenance of that section. I guess I feel like this should be included as part of the standard header so there is uniformity amongst plugins. WHM::header('Plugin Name', 0, 0, 1); with one of the parameters "show/hide Breadcrumbs"
    0
  • cPanelThomas
    > I guess I feel like this should be included as part of the standard header so there is uniformity amongst plugins. I definitely agree on that point. I filed CPANEL-42488 internally to track this so that I don't forget about this. Not sure when I'll get it merged, etc., as I'll need to beg/borrow/steal a QA & docs person to go over the changes, but hopefully I can get it into v112
    0

Please sign in to leave a comment.