Search

Hi folks,

is there a way to get the styling of tags by applying .tags class to a ul, without having the element behave like a taglist? Because admin.js applies .symphonyTags to all elements with a class of .tags I think i have to re-create the exact styling on another class just to avoid that.

I am hacking together an extension with a field that behaves similar to a taglist but needs some extras which i do not get from the plugin. As i don't know how to extend the plugin in a way that would make sense i am writing a little custom plugin for the extension but still want to use the .tags class for styling and semantics.

Any thoughts? :)

Namespace the class? .extension-name-tags.

hm, i don't know if that would help :P

  • i want to use the standard symphony tag-styling, which is bound to class .tags
  • i do not want my element to use the symphonyTags() plugin, which also is bound to class .tags

having both css and js trigger off the same attribute sadly is kinda inflexible. but maybe i am missing something obvious, it happens to me all the time :)

I've just come across the same thing. In my case, adding a class of singular to the list gets me part way there but I also need the value entered in to the input to be different to the tag name.

Image of my use case

So I think I will need to add my own JavaScript.

I don’t know JavaScript very well at all. Is there a reliable way to stop the symphonyTags plugin from acting on a list with the class of tags if the list were, for example, to have an additional class to hook onto?

Unfortunately, there isn't a way to do this at the moment. Symphony blindly adds the Tags plugin to any element with the .tags class.

There's options, are neither are amazing:

  • Copy the Symphony tags styles into your own stylesheet
  • Copy the Symphony plugin into your own script and change as desired

This is something we should consider in the future. Perhaps applying the styles with .l-{component} and then behaviour with .mod-{component}.

yeah, had to do both, as i need the styling of the .tags class but cannot add it because of the js.

concerning separation of styles and behavior i usually go with classes for styling and data-attributes to trigger behavior off.

The best solution for this issue is something like this slightly obtrusive javascript

Also pointed by Nils on #2019

basically the same, i'd still go with data-* for js as it clearly separates it from styiling which which you bind to classes.

you could use class="tags" to apply styles and data-class="tags" or maybe data-trigger="tags" to execute js. then you would use something like data-tags-mode="singular" to provide parameters to the plugins/events.

but it's all a matter of taste really :)

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