[Added in v3.3.0+] Custom layouts for image field ?

More
8 years 1 month ago - 8 years 1 month ago #72384 by lipatovroman
Hello!
Is it possible to override template for image field?

I'm talking about this file: /plugins/flexicontent_fields/image/image.php
Last edit: 8 years 1 month ago by ggppdk.

Please Log in or Create an account to join the conversation.

More
8 years 1 month ago - 8 years 1 month ago #72385 by ggppdk
Hello

I'm talking about this file: /plugins/flexicontent_fields/image/image.php


in v3.2.x no


in v3.3.x yes,

the layout code was removed from file
Code:
/plugins/flexicontent_fields/image/image.php

and moved to layout files, 1 for every case

so in v3.3.0-dev

- we have added 1 custom layout per JS gallery
- every layout also can have its own XML parameters (see the new option of the slideshow-carousel layout in v3.3.0-dev)
- a different layout can be choosen for mobile !

you can just duplicate on of the 7 existing layouts and customize it, (do not forget to select it in image fields configuration)


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star review. Thanks!
Last edit: 8 years 1 month ago by ggppdk.

Please Log in or Create an account to join the conversation.

More
8 years 1 month ago #72389 by lipatovroman
Hello.

I need to change and add extra code to line
Code:
$alt_image_prefix = flexicontent_html::striptagsandcut($item->title, 60) . ' ' . JText::_('FLEXI_IMAGE') . ' ';

It placed in /plugins/flexicontent_fields/image/image.php

it not moved to to layout files.

Please Log in or Create an account to join the conversation.

More
8 years 1 month ago - 8 years 1 month ago #72390 by ggppdk
Hello

you do not need to change you can just not use it in your layout
i mean if you do not like, then search in files, copy the code to the layout and customize it


Code:
// FIND THIS LINE in the (image) VALUE loop your custom layout $result = include( JPATH_ROOT . '/plugins/flexicontent_fields/image/tmpl_common/prepare_value_display.php' ); // AFTER the above add the code you want to customize $alt_image_prefix = flexicontent_html::striptagsandcut($item->title, 60) . ' ' . JText::_('FLEXI_IMAGE') . ' '; $alt = ($usealt && isset($value['alt'])) ? $value['alt'] : $alt_image_prefix . ($n + 1); // Then e.g. for LARGE thumbnail $img_legend = '<img src="'.JUri::root(true).'/'.$srcl.'" alt="'.$alt.'"'.$legend.' class="'.$class.'" itemprop="image"/>'; $img_nolegend = '<img src="'.JUri::root(true).'/'.$srcl.'" alt="'.$alt.'" class="'.$class.'" itemprop="image"/>';

So you see you do not need to hack / modify / override the core file image.php

but i am not sure if it is worth creating a custom layout just for changing the ALT in the image,
in any case it is possible


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star review. Thanks!
Last edit: 8 years 1 month ago by ggppdk.

Please Log in or Create an account to join the conversation.

More
8 years 1 month ago #72405 by lipatovroman
Can't understand how to create custom template.
I duplicated files

/biblsoft/data/www/biblsoft.ru/plugins/flexicontent_fields/image/tmpl/value_gallery_fancybox.php
/biblsoft/data/www/biblsoft.ru/plugins/flexicontent_fields/image/tmpl/value_gallery_fancybox.xm

and renamed them.

But they not appeared as new template in field settings...

Also I found custom layouts



But it's not clear how to use it and where they placed...

Please Log in or Create an account to join the conversation.

More
8 years 1 month ago #72406 by lipatovroman
Strange things...
After several page refreshes - my duplicated layout displays in settings

Please Log in or Create an account to join the conversation.

More
8 years 1 month ago #72407 by lipatovroman
Ok, I added code, as you said:



But test text does not displays in frontend.

Please Log in or Create an account to join the conversation.

More
8 years 1 month ago #72411 by ggppdk
Hello

then the $alt
i used to create

$img_legend

in your case you need the $img_legend for large thumbnail

see the full code that i posted


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star review. Thanks!

Please Log in or Create an account to join the conversation.

More
8 years 1 month ago #72415 by lipatovroman
Hello

Sorry, bit it does not work...

Please Log in or Create an account to join the conversation.

More
8 years 1 month ago #72420 by ggppdk
Hello


checkout the code that you are using
e.g. if the value was specified the it will be used

if you expect the code to also change the title / tooltip it will not !

the change is for the "alt" which appears only when image file is not found

so i am not sure what you mean with not working

please do you testing

e.g. do
Code:
echo ' TEST: img Tag is '. htmlspecialchars($img_legend) . '<br>';

make testing modifications and repeat


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star review. Thanks!

Please Log in or Create an account to join the conversation.

Moderators: vistamediajoomlacornerggppdk
Cookies user preferences
We use cookies to ensure you to get the best experience on our website. If you decline the use of cookies, this website may not function as expected.
Accept all
Decline all
Essential
These cookies are needed to make the website work correctly. You can not disable them.
Display
Accept
Analytics
Tools used to analyze the data to measure the effectiveness of a website and to understand how it works.
Google Analytics
Accept
Decline
Save