CSS class doesn't show when link is image, not text

Author Message

Yasen Georgiev

Friday 30 April 2010 3:31:25 am

Hi,

This is my first post here (very new to EZ Publish at all), so please bear with me if I'm asking something trivial :)

Well, I have customized my extension/ezoe/settings/content.ini.append.php to allow custom CSS classes to be added to links:

[link]
...
AvailableClasses[]=issuu
AvailableClasses[]=slideshow

After this, I'm able to set the classes "issuu" and "slideshow" to the text links in the WYSIWYG editor for the content.

And this works when the link is text link.

However, when I insert an image and make it link and select the link class to be "slideshow" for example, the CSS class doesn't go to the link attributes.

Please, advise if I missed something or I did something wrong ?

Regards,
Yasen Georgiev

Robin Muilwijk

Friday 30 April 2010 1:31:17 pm

Hi Yasen,

First welcome to the community portal. Second, about your problem applying classes to images, have a look at http://share.ez.no/forums/setup-design/solved-classes-for-images-in-oe.

That topic might provide you with a solution. If not, please post again and let us know.

Regards Robin

Board member, eZ Publish Community Project Board - Member of the share.ez.no team - Key values: Openness and Innovation.

LinkedIn: http://nl.linkedin.com/in/robinmuilwijk // Twitter: http://twitter.com/i_robin // Skype: robin.muilwijk

Yasen Georgiev

Sunday 02 May 2010 11:52:42 pm

Hi Robin,

Thanks for the warm welcome :)

I've searched the forum before posting and found the topic you've suggested. I've tried it, but without success.

I've checked which template renders the image within the link that I've set as "slideshow". I found that actually there are 3 templates for rendering an embedded image. Here are the used templates:

design/standard/templates/content/datatype/view/ezxmltags/embed.tpl
extension/ezwebin/design/ezwebin/override/templates/embed/image.tpl
extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezimage.tpl

In the first one - embed.tpl - there is a variable $link_parameters which has a property class that contains the right CSS class I've set - "slideshow".

In the second template - image.tpl - there is also a variable $link_parameters which holds the proper CSS class name.

However in the third template - ezimage.tpl - there is no $link_parameters variable. There are two other variables - $link_class and $css_class that I thought might contain data abouth the CSS class "slideshow", but no luck :)

I've tried to pass the $link_parameters from image.tpl to ezimage.tpl like this (image.tpl):

{attribute_view_gui attribute=$object.data_map.caption link_parameters=$link_parameters}

but again no luck :) In the ezimage.tpl I get the passed variable $link_parameters as not defined.

Also, when I'm editing the content via the WYSIWYG editor, when I check the HTML source code for the embedded image within the link, it is properly rendered with the CSS class "slideshow" (the A tag that is wrapping the image). However when I publish the content the link doesn't contain the CSS class anymore.

I suppose if I can pass the $link_parameters to ezimage.tpl or find where the A tag is stripped upon publishing, this could help. Or any other solution, of course :)

Any suggestions are highly welcomed!

Regards,
Yasen Georgiev

Robin Muilwijk

Monday 03 May 2010 11:35:21 am

Hi Yasen,

Which version are you using? I could not find the file

extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezimage.tpl

Thanks Robin

Board member, eZ Publish Community Project Board - Member of the share.ez.no team - Key values: Openness and Innovation.

LinkedIn: http://nl.linkedin.com/in/robinmuilwijk // Twitter: http://twitter.com/i_robin // Skype: robin.muilwijk

Yasen Georgiev

Monday 03 May 2010 11:51:29 am

Hi Robin,

I'm using 4.2 with ezwebin.

Regards,
Yasen Georgiev

Robin Muilwijk

Tuesday 04 May 2010 11:31:26 am

Hi,

Could it be that ezimage.tpl comes from \design\standard\templates\content\datatype\view?

-- Robin

Board member, eZ Publish Community Project Board - Member of the share.ez.no team - Key values: Openness and Innovation.

LinkedIn: http://nl.linkedin.com/in/robinmuilwijk // Twitter: http://twitter.com/i_robin // Skype: robin.muilwijk

Yasen Georgiev

Wednesday 05 May 2010 2:35:55 am

It could be. Perhaps I have it somewhere overridden. I'll dig into that direction.

Thanks Robin!

Regards,
Yasen Georgiev

Yasen Georgiev

Wednesday 05 May 2010 7:54:16 am

Problem solved :)

The problem was that in the second template:

extension/ezwebin/design/ezwebin/override/templates/embed/image.tpl

the link class parameter was not passed to the third template:

extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezimage.tpl

within the {attribute_view_gui ...} statement.

And it was expected in the third template as a variable $link_class.

So, I've just passed it :) from the second template:

{attribute_view_gui attribute=$object.data_map.image link_class=$link_parameters.class image_class=$object_parameters.size ...... }

I don't know if the missing of this parameter is intentional or implemented somewhere else, but now applying a CSS class to a link when you have an image instead of text, works :)

Or it could be a bug and if so, it should be reported. But I don't know how to make sure if it's a bug or just a problem on my side.

Regards,
Yasen Georgiev

Robin Muilwijk

Wednesday 05 May 2010 11:00:00 am

Hi Yasen,

Good to see you fixed it. Could you mark your original post as Solved? (Should be a checkbox if you edit it). I've passed on a message to one of the dev's so he can check if this is a bug or not.

Regards Robin

Board member, eZ Publish Community Project Board - Member of the share.ez.no team - Key values: Openness and Innovation.

LinkedIn: http://nl.linkedin.com/in/robinmuilwijk // Twitter: http://twitter.com/i_robin // Skype: robin.muilwijk

Yasen Georgiev

Wednesday 05 May 2010 12:50:05 pm

Hi Robin,

Thanks a lot for the support!

Regards,
Yasen Georgiev

Robin Muilwijk

Thursday 06 May 2010 12:17:50 am

Hi Yasen,

The developer confirmed this as a bug, could you please report it on the issue tracker? See http://issues.ez.no/

Thanks, Robin

Board member, eZ Publish Community Project Board - Member of the share.ez.no team - Key values: Openness and Innovation.

LinkedIn: http://nl.linkedin.com/in/robinmuilwijk // Twitter: http://twitter.com/i_robin // Skype: robin.muilwijk

Yasen Georgiev

Monday 10 May 2010 8:41:48 am

Done :)

Thanks for all the support, Robin!

Regards,
Yasen Georgiev

André R.

Wednesday 19 May 2010 10:17:33 am

I guess this is caused by lines bellow in settings/override/content.ini.append.php, you can comment them out using "#" to fix it.

[embed-type_images]
AvailableClasses[]

eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription
@: http://twitter.com/andrerom

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.