Search

I am attempting to develop my first symphony extension, just simple input field type, and I need a few pointers.

Firstly, I am new to git/github and was wondering if developers here tend to develop locally until their extension is in some way working and then push to github for public consumption, or develop from/to a github repo from day one. I am coming from SVN so forgive me if I get any terminology or concepts wrong.

Secondly - are there any good tutorials or even guidelines for the minimum requirements that extension/field code must meet? I tried duping an existing field, removing and tweaking a few bits, but now I can’t get mine to “enable”. I have no idea what is missing or what is wrong!!

Many thanks in advance.

You should make your extension a git repository from day one, and commit changes at least daily (assuming there are changes).

And when it comes time to release, you should do something like:

git commit -m "Releasing 1.0.1."
git push
git tag 1.0.1
git push --tags

This means that people can switch to a particular version of your extension with one simple git command, and if you use github, it will let users download archived copies of your tagged releases.

I normally develop silently until an extension is in a working state. If you’re extension is great and needed by many users you will raise expectations if you publish it too early (my two cents).

If you start creating a field type you’ll need the following files and folders:

/yourextension
    /fields
        /field.yourfield.php
    /extension.driver.php
    /LICENCE
    /README.markdown

While extension.driver.php initialises your extension field.yourfield.php represents everything your field does. As the API and extension documentation is still in the works I would search for a field offering similar functionality as a starting point for your own development.

As for developing a new Field Type, you can basically just extend the Field class and add a few functions to it and you’ll have a working field.

I’d suggest looking at a pretty boring text box field type as a guide of what’s involved. (All the functions are grouped by what they do.)

Here’s a quick rundown on the most important functions:

  • __construct - Controls basic settings and what the field will be called
  • createTable - Create the data structure that your field will save data into
  • commit - Saves settings on the section edit page, see the displaySettingsPanel function for the form fields.
  • checkPostFieldData - Validate data being saved into the fields table.
  • processRawFieldData - Prepares the data as an array, ready to be inserted into table.
  • appendFormattedElement - Formats the data as XML to transform with XSLT.
  • prepareTableValue - Formats the value to display in the publish page tables.

The rest should be fairly obvious once you get started.

Thanks guys. I can see that controversy rages over whether to publicly host code from the start or not!!

Thanks for the extension structure and coding tips.

For the record, you don’t have to put it on github as soon as you start, but you should make it a git repository from the get go.

I tend to put it on github immediately because it’s a useful tool.

I agree with Rowan, don’t see any problem with putting it on Github before it’s ready as long as you don’t add it to the list of extensions on this site. Probably worth chucking a caveat in the README/description just to be safe.

Also If you’ll write jQuery code I recommend you read some of these articles: jQuery Performance Rules, A Plugin Development Pattern, Plugins/Authoring.

There are another links on my delicious.

For the record, you don’t have to put it on Github as soon as you start, but you should make it a git repository from the get go.

Agreed. I had a bit of a learning curve with git (revision control in general), but it was well worth it. Github is also a great way to distribute and share your masterpiece.

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