Adding a css class to a link, in a content block


When editing a link in a content block, a dialogue appears with
a couple of tabs and options. On the 'General' tab the last field is called class and its value is 'NOT-SET'. I would like to add a class to this drop-down box so i can attach that class to the link.

Any ideas how this can be achieved?

thanks in advance

View Replies: View Best Answer
cgrauer replied on at Permalink Best Answer Reply
You have 2 options:

1. in the link dialog you find the tab "advanced" and there the field "class". Here you put the classes you want to use with your link!

2. customize tinymce (the wysiwyg-editor used by c5) on the "sitewide settings" page an add a line like this to the parameter:
theme_concrete_styles: "My Link Class=mylinkclass"

Then put .mylinkclass { blah... } into the typography.css in your theme directory and you will find this class in the selction you mentioned as well as in the "Styles" selection field at the editor dialog.
mackenzy replied on at Permalink Reply
Hey cgrauer, thanks for your reply.

I used the second method which works great.
The class appears in the drop down which is ideal

BUT I've run into a new problem...

I created the link in the content editor by selecting 'Insert link to page', the site-map appears and then i select the page I want to link to. Fine. Still in the editor, I highlight the link, and then click the link icon, which bring up the dialogue with various options and tabs. In the 'GENERAL' tab, i selected the newly added class, to attach to my class. Fine. Problem is the the first field specifying the url is empty. I am surprised this hasn't been picked up, as i did specify what page i wanted to link to and I'm having to enter the url again in order to attach the class.

I want avoid having to specify a url to link to page. Is it possible to edit some code so that the url field to picks this up automatically?

I wouldn't have a clue where to start.
Any ideas?
cgrauer replied on at Permalink Reply
I can't confirm this behaviour. On my site the url field is not empty but contains the link to the page using the cID instead of the pretty URL and I can still choose a predefined class!

You should make sure that adding the class you highlight exactly the same letters as you did when inserting the link to the page. It's even better to only put the cursor into the link and than click on the link button. If you highlight different characters (even one more whitespace!), a new link is created!
mackenzy replied on at Permalink Reply
Your right! Instead of highlighting the link with the mouse to select it(which i thought was normal behaviour). Now I clicked into the link and now the url appears!

Thanks for your help