Hello,
I want to adapt the timelines addon for my needs via overriding. How to add in the code of the view the possibility of inserting an image under the date of the chronology?
Thanks
Hello,
I want to adapt the timelines addon for my needs via overriding. How to add in the code of the view the possibility of inserting an image under the date of the chronology?
Thanks
Thanks a lot.
And congratulation, you made it alone.
Hi,
yes, you have to override timeline addon.
General guide you will find here (tip 7.) >> https://www.joomshaper.com/documentation/sp-page-builder/sp-page-builder-3/how-to-tips
You have to edit both files:
Whole rest is on your hands. As you know code customization is beyond JoomShaper support.
Thanks.
I started modifying the admin.php file to add the image/alt file, ... fields for each item in the timeline. It works.
But how to call on the front side in the site.php file the url of each image?
Thanks.
check how it was made inside image addon. Basic php/html
compare code!
That's what I'm doing. I'm inspired by the Image addon ;)
I managed to call the first image of the array but not the following via this command:
$image_item = $timeline->image;
$output .= '<img src="'.$image_item->src.'"/>';
The command is in the foreach loop.
If you can give me a tip thank you.
Support Policy = No php code/customization help.
I understand so I will provide the answers. It may help others.
In the admin.php file of the Timeline addon I added this:
'image'=>array(
'type'=>'media',
'title'=>JText::_('COM_SPPAGEBUILDER_ADDON_IMAGE_SELECT'),
'desc'=>JText::_('COM_SPPAGEBUILDER_ADDON_IMAGE_SELECT_DESC'),
'show_input' => true,
'std'=> array('src' => 'https://sppagebuilder.com/addons/image/image1.jpg','height' => '','width' => ''),
),
'alt_text'=>array(
'type'=>'text',
'title'=>JText::_('COM_SPPAGEBUILDER_GLOBAL_ALT_TEXT'),
'desc'=>JText::_('COM_SPPAGEBUILDER_GLOBAL_ALT_TEXT_DESC'),
'std'=>'Picture',
'depends'=>array(
array('image', '!=', ''),
),
),
between the lines 'content'=>array(...) and 'date'=>array(...)
This allows the admin side to have 2 additional fields per item: a file field and an Alt field for the image.
On the side of the site.php file that i overide i have added these lines:
$image_timeline = isset($timeline->image) && $timeline->image ? $timeline->image: '';
$image_timeline_src = isset($image_timeline->src) ? $image_timeline->src: $image_timeline;
$output .= '<img src="'.$image_timeline_src.'" alt="'.$timeline->title.'">';
after the foreach loop to display each image of each item.
I have not yet succeeded in recovering the ALT variable of the image so by default I recover the title of the item.
Have a good day