Simple, Basic Extension How To
This is an open discussion with 2 replies, filed under Extensions.
Search
I’m afraid what you’re after is not possible with just AddElementToFooter
. That delegate let you add items to the list on the other side of the page.
As for extensions structure, it’s pretty straightforward.
- Create a folder in your extension directory with the name of your extension. Don’t use dashes, the only non-alphanumeric character allowed is the underscore.
- Inside the folder, create an
extension.driver.php
file. Paste this code.
We’re almost there. There are two important things to notice.
- Extensions class names always follow this pattern:
extension_directoryName
. Pay attention to this simple rule otherwise simphony won’t find your extension. getSubscribedDelegates()
must return an array of arrays, each containing a valid subscription. More info in the learn section. Everytime you add a new delegate, you must re-enable the extension. Again, this will save you some headaches.
The last thing left to make this work is to actually code the delegate. For your purposes, a simple method like this will do:
public function AddElementToFooter($context) { $context['wrapper']->prependChild(new XMLElement('li', 'My custom text')); }
Here, $context['wrapper']
is an instance of XMLElement
, so you could use, for example, appendChild
instead of prependChild
to insert the new item a the end of the list.
Delegates receive only one argument: $context
. It is an associative array whose values are described in the docs for the delegate you’re subscribing to. There are three parameters always present: parent
, page
and delegate
.
Oh my … Really detailed explanation. Perfect. Thanks a lot.
Edit:
Hmm, it seems I can add text only in the lower right corner. Anyway, it worked and I understood the basics about extensions. Next ! :)
Create an account or sign in to comment.
Hi there. I would like to add some custom text to the back end footer, see attachment, and have no clue about doing that via an extension.
In “symphony/lib/toolkit/class.administrationpage.php” at line 153, I found the Symphony version and attached what I need to it
but I will like to use the delegate “AddElementToFooter” from line 170:
Anyone care to help, please?
Thank you.