Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
How to extend a control
What I want to do is to surround the DiscussionGrid by a <div> element.
Now I'm wondering what would be the best way to go.
I came up with the extension below, the only thing that bugs me about that solution is having to call the constructor of DiscussionGrid() directly. I'd rather be able to somehow extend the discussiongrid, but I can't seem to get that to work...
Here's my code that I have now:
if(($Context->SelfUrl == 'index.php') && $Context->Session->User->RoleID)
{
$Context->ObjectFactory->SetReference("DiscussionGrid", "MyHackedGrid");
class MyHackedGrid extends Control
{
var $Context;
var $DiscussionGrid;
function MyHackedGrid(&$Context, $DiscussionManager, $CategoryID, $View)
{
$this->Context =& $Context;
$this->DiscussionGrid =
new DiscussionGrid($Context, $DiscussionManager, $CategoryID, $View);
}
function Render()
{
$this->Context->Writer->Write('<div id="DiscussionGrid" style="border: 1px solid red">');
$this->DiscussionGrid->Render();
$this->Context->Writer->Write('</div>');
}
}
}
0
This discussion has been closed.
Comments
Ok, on to the next problem I encountered duing my extension creation:
What I want to do is the discussionmanager not to use 'static paging' but I want to be completely free to set the offset & count. Ie. I want to be able to get rows 13 to 99.
Ofcourse I could inherit from the standard discussionmanager, but then: what if someone has the WhisperExtension turned on? ... what brings me to the generic problem: what if more then 1 extension wants to override the discussionmanager?
Currently it will take the last SetReference (if I'm not mistaking).
The only thing I can think of, is to wait for 0.9.3 and hope ;-) that there will be a delegate during the GetDiscussionList that allows me to alter the created query before it's fired.... or are there better alternatives?