Announcement

Symphony's issue tracker has been moved to Github.

Issues are displayed here for reference only and cannot be created or edited.

Browse

Closed#428: Different duplicator markup between 2.2 and extensions

As alluded to in this post: http://www.getsymphony.com/discuss/thread/785/3/#position-49

In 2.2 the section editor duplicator follows this markup:

<div>
    <h3 class="label">Fields</h3>
    <ol id="fields-duplicator" class="orderable duplicator collapsible">
        <div class="controls top hidden">
            <a class="collapser disabled">Collapse all</a>
        </div>
        <div class="controls">...</div>
    </ol>
</div>

Whereas the Email Template Filter extension implements a duplicator with the following default markup:

<div class="subsection">
    <h3>Conditions</h3>
    <ol> </ol>
    <div class="actions">
        <a>Add item</a><a class="inactive">Remove selected items</a>
    </div>
</div>

I don’t follow duplicator development very closely, but it seems like something changed along the way leaving extensions implementing duplicators one way, and the core implementing them another way?

One for the JS Working Group to figure out…?

As far as I know the duplicator markup changed with the addition of the plugin to the core. So I guess the extensions don’t rely on the core duplicator plugin. As long as nothing is broken I don’t consider this as a core issue. If it’s an issue it needs to be fixed in the extensions directly.

It seems like this has been introduced in Symphony 2.0.6. As Simone noted on Basecamp the plugin contains legacy code for compatibility reasons so this should not be considered as bug. The old implementation should be marked as deprecated in the JavaScript.

I guess we should point out some best practices for developers in blog posts after the release of Symphony 2.2.

One thing I noticed is that the old duplicator doesn’t work for me. If I click on “Add item” nothing happens. Maybe this is something that has to do with Email Template Filter (the only one I tried with), don’t know…

One thing I noticed is that the old duplicator doesn’t work for me

This is why I first created this thread, see the discussion linked in the first post — there have evidently been some CSS changes which break old duplicators. It’s not just Email Template Filter, but any extension that uses this now-legacy implementation. Symphony should remain backwards compatible no?

I had a look at forms.css and as Knupska said there’s a display: none rule that makes the old duplicator “out of order”.

I don’t see any reasons why such a rule should exist. I removed it and everything seems to work as expected — I’ve tried this small change on some old extensions like Global Parameter Loader, Email Template Filter and URL Router.

Your extension, Nick, is okay because it uses the most recent duplicator (which, by default, isn’t collapsible so it’s not affected by my latest changes).

To sum it up, it looks like the fix is as simple as removing three lines from a file.

Nice one. Can you trace the line back through git commits to get a handle for why it might have been added in the first place?

And the culprit is…. jQuery (lol). In fact, since 2.1.1 there hasn’t been any change related to the old duplicator. The only thing that could affect it was the update to jQuery 1.4.3. I tried to manually replace jquery.js with the newest version and the old duplicator magically ceased to work.

So, I think it is safe to just remove the following lines from forms.css:

.subsection li.template {
    display: none;
}

Thoughts?

Symphony should remain backwards compatible no?

Just as a sidenote: I don’t think so. Symphony is a minor release and thus not just a maintenance release. For the first time we are really cleaning up things so it won’t be possible to keep all old code working. In my opinion this is just fine as we are not taking away features and the duplicator issue actually started in Symphony 2.0.

Most of th extensions that may have problems haven’t been updated since 2.0.7. So it’s time to get this done. With 2.2 we will get a well documented core which deprecates things nicely. We haven’t done this before, but this shouldn’t force us to keep everything available as is in 2.2.

However, since this change involves literally three lines of code, I think it is a good idea to keep the old duplicator.

Yeah I think the latter. The old duplicator can be marked as deprecated, and if we ever get round to writing documentation for extension developers, we will need to document the correct way of implementing a duplicator :-)

My vote is to remove the legacy code. The new code is around for more than a year and although it hasn’t been marked as deprecated correctly it is best practice to use the new duplicator since then.

I really think 2.2 will and should force best practices for extension developers and as there are a few changes that will break current implementations (e. g. the changes for the extension class that Brendan mentioned on GitHub) I see no need to keep the old code.

In my opinion Symphony 2.2 should shout out loud that it’s the most polished, most stable Symphony release in the 2.x branch and that it defines new standards that extension developers need to follow as well.

As far as I know there are currently 3 extensions using the old duplicator: Email Template Filter, Global Parameter Loader and URL Router. My assumption is that Global Parameter Loader is the most appreciated and used by developers. If we decide to remove the legacy code, we should at least ensure that every author is still available to maintain/update his own extension. (Actually, this raises a much bigger problem: how are orphaned extensions supposed to be treated in the future?)

how are orphaned extensions supposed to be treated in the future

Define an orphaned extension?

Extensions that are (going to be) no longer maintained by their authors. It is a terminology used on AUR (Archlinux Community Repository) to indentify packages that don’t have a maintainer.

Understood, thanks.

Hmm, I imagine they are either abandoned or adopted. I adopted an ex-colleague’s extensions when he left (EventEx, DatabaseManipulator) but am hoping to let them lie dormant unless there is renewed interest.

We have very few orphaned extensions, which is a good thing.

We have very few orphaned extensions, which is a good thing.

Are you sure about this. Maybe we should evaluate the the extension list after 2.2 has been published. We could create a list of abandoned extensions and find a new maintainer or remove those that have become irrelevant.

As far as I know there are currently 3 extensions using the old duplicator: Email Template Filter, Global Parameter Loader and URL Router.

I’d like to propose that we remove the legacy code and inform the extension authors about the change when releasing 2.2 beta/RC. It shouldn’t be that hard to adopt the new code which is much cleaner, the old one is a mixture of old snippets written by Scott which don’t make use of the features jQuery is offering.

By the way, should we move this discussion to Basecamp to make use of e-mail notifications for new posts?

The old duplicator has been removed from 2.2dev. This issue can be closed.

This issue is closed.

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