Search

The Learn section is as recent as it gets. Simply have a look at the regular generated events or extensions that are similar to what you’re trying to achieve. From there on simply var_dump() your way through the instances and classnames… :-)

Bumping this thread a bit since I'd really like to learn more about creating custom events.

I am still quite new to Symphony and I am not really a PHP programmer but I'm confident that I'll be able to pick up creating simple extension and (custom) events. However: at the moment some simple documentation related to creating custom events is missing.

In my case I am trying to add some simple extra validation to a form in the form of a honey-pot field. (I know there's probably an extension for this but I'd really like to be able to hack something simple like this together myself).

What I want to do is add a text-field to my form with a simple, human-readable, question (like "What is one plus one?"). This field is filled in, and hidden, with JS/CSS.

Because the field is not 'native' to Symphony I need to add the 'validation' to my event myself.

My guess is that I should either code the validation in the load() or __trigger() functions. But which one? Also: how should I code/setup validation errors (and messages). What should I return, etc. I have also seen the EventPreSaveFilter delegate which seems a candidate for my custom validation also.

Could someone help me along? It's probably a very simple thing but newcomers like me need just a little bit more info to start ;)

This may of been launched relatively unnoticed, but I wrote a field extension tutorial, that's a bit of a quick overview into the the ins and outs of creating a Field extension, written in the Meta Keys context.

I do have a Event tutorial in the works, which currently covers changing event priority and how to chain multiple events together.

As for your situation, have you read the event documentation? The load function basically checks whether or not this event should be executed. The __trigger() function actually contains the logic of the Event. I guess you could place your condition in the load function, as I assume it's a bit of a captcha style, and you don't want the event to process if the user fails the task.

However, if you want to return an error in your XML that they failed the test, this will need to be done in the __trigger() function. Why? Because the return XML is only created in this function, and if you do the logic in the load function, no XML will be returned for the event (as it's never called).

Thanks Brendo. I have read your (field-) extension tutorial and it is very well written and clear.

As for the Event Documentation - I totally missed it! The API docs are quit new and I only looked at the Learn Event Filters section which gives a nice overview but does not help me create my own custom validation.

(As you've described also) the following description in the API Docs is helpful in the context of my question:

A load function determines whether this Event matches the action and if so, call the Event's __trigger() to run the logic. On every page load, all Event's that are attached to the page will have their load function's executed.

Still, I very much look forward to your Events tutorial, thanks for all your work!

is this list of delegates the most up-to-date for extensions to use?

Nope, best refer to the latest API docs that list all of the delegates.

ah, thanks nick

is there a way to do ajax requests on an admin page for an extension? Just for testing purposes, I pointed my browser to the extensions folder plus /content/content.ajax.php but that returned the page not found page. So i figured it was a folder naming thing so i switched content to services: services/services.ajax.php but both times i receive the same error page. has anyone had any experience with this?

The MVC naming convention is something like this:

/extensions/my_extension/content/content.my_page.php

Will be accessed as:

/symphony/extension/my_extension/my_page/

There are naming conventions for building pages. So the class within content.my_page.php would follow this convention:

Class contentExtensionMy_ExtensionMy_Page extends AdministrationPage {

    public function __construct(&$parent) {
        parent::__construct($parent);
    }

    public function __viewIndex() {
            // the default view is here
    }
}

You can add different views to a single page using the action switchboard.

If you want the page to be an AJAX-page only then Symphony has an AJAXPage class that you would use rather than AdministrationPage. But I've never worked out quite how to use it, so I just use a normal page and use the header() function to send text/xml instead.

Hello, is anyone aware of any good resource about symphony cms extensions development with api docs, tutorials etc.?

Many thanks.

Have you looked around this website?

http://getsymphony.com/learn/api/2.2.5/

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