Search

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

$version = new XMLElement('p', 'Symphony ' . Symphony::Configuration()->get('version', 'symphony') . ' --- Text from my Extension', array('id' => 'version'));

but I will like to use the delegate “AddElementToFooter” from line 170:

$this->_Parent->ExtensionManager->notifyMembers('AddElementToFooter', '/backend/', array('wrapper' => &$ul));

Anyone care to help, please?

Thank you.

Attachments:
stringExtension.PNG

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.

AddElementToFooter example

As for extensions structure, it’s pretty straightforward.

  1. 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.
  2. Inside the folder, create an extension.driver.php file. Paste this code.

We’re almost there. There are two important things to notice.

  1. Extensions class names always follow this pattern: extension_directoryName. Pay attention to this simple rule otherwise simphony won’t find your extension.
  2. 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.

Attachments:
footer.png

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.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details