Template question with ezoe/attribute_view_gui

Author Message

Russell Michell

Thursday 07 January 2010 12:01:32 pm

Hi all, forgive me if this should really be in another forum, but here goes:

I have a template override for content/datatype/view/ezimage.tpl inside a custom extension. The override mechanism is fine, but using the 'attribute_view_gui' template function, I should be able to pass specific input parameters like:

image_class, css_class, link_to_image, href, border_size 

The values to pass to each of these inputs come from either $object, $object_parameters or $link_parameters, and these work apart from for the css_class input. Which object variable contains a CSS class string I can use to pass to the css_class input from an ezoe image-insert popup/dialogue?

Here is the line of code I was staring at for a whole afternoon yesterday: I have hard-coded a CSS class passed to the css_class input which works as expected but I want to take the value of a drop-down menu of CSS classes in an ezoe image-insert popup/dialogue so it's dynamic not static:

{attribute_view_gui attribute=$object.data_map.image 
image_class=$object_parameters.size 
href=$link_parameters.href 
target=$link_parameters.target 
css_class=image-right}<a></a>

I hope I have explained this OK and thanks for reading :-)Russ

Russell Michell, Wellington, New Zealand.
We're building! http://www.theruss.com/blog/
I'm on Twitter: http://twitter.com/therussdotcom

Believe nothing, consider everything.

Jérôme Vieilledent

Friday 08 January 2010 5:33:37 am

Hi Russell

When inserting an image in ezoe, you actually embed an image content object (content/view/embed.tpl or content/view/embed-inline.tpl). This is the default, but you can customize by choosing another view among those available in the appropriate dropdown menu.

Best thing to do is to propose a CSS class through content.ini (take look at extension/ezoe/settings/content.ini.append.php). Assuming that you want to have a my-super-css-class, you would have this in your content.ini override :

[embed]
AvailableViewModes[]=embed
AvailableClasses[]=my-super-css-class

[embed-type_images]
AvailableClasses[]=my-super-css-class

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

eZ debug

Timing: Jan 18 2025 05:10:04
Script start
Timing: Jan 18 2025 05:10:04
Module start 'layout'
Timing: Jan 18 2025 05:10:04
Module start 'content'
Timing: Jan 18 2025 05:10:05
Module end 'content'
Timing: Jan 18 2025 05:10:05
Script end

Main resources:

Total runtime1.0125 sec
Peak memory usage4,096.0000 KB
Database Queries54

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0071 588.1641152.6563
Module start 'layout' 0.00710.0034 740.820339.5078
Module start 'content' 0.01061.0002 780.3281544.0547
Module end 'content' 1.01070.0018 1,324.382812.1094
Script end 1.0125  1,336.4922 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00340.3360160.0002
Check MTime0.00140.1363160.0001
Mysql Total
Database connection0.00070.064310.0007
Mysqli_queries0.951093.9233540.0176
Looping result0.00100.0979520.0000
Template Total0.972096.020.4860
Template load0.00210.211620.0011
Template processing0.969895.784320.4849
Template load and register function0.00020.023910.0002
states
state_id_array0.00130.124910.0013
state_identifier_array0.00250.246320.0012
Override
Cache load0.00170.1720270.0001
Sytem overhead
Fetch class attribute can translate value0.00060.060020.0003
Fetch class attribute name0.00130.126440.0003
XML
Image XML parsing0.00100.098020.0005
class_abstraction
Instantiating content class attribute0.00000.000640.0000
General
dbfile0.00160.1544230.0001
String conversion0.00000.000940.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
2content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
2content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
7content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
4content/datatype/view/ezxmltags/strong.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/strong.tplEdit templateOverride template
3content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
3content/datatype/view/ezxmltags/emphasize.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/emphasize.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 23
 Number of unique templates used: 8

Time used to render debug report: 0.0002 secs