We build. You grow.

Get best community software here

Start a social network, a fan-site, an education project with oxwall - free opensource community software

Truncating Event Text in Event Widget | Forum

Topic location: Forum home » Support » General Questions
Musik
Musik Oct 2 '14
Apologies if this has been answered before. I browsed the forums and spent a good chunk of time attempting to resolve this myself.


My goal is to either truncate or remove the preview text for the events in my Event widget. I was able to remove the preview text from my Latest Posts forum widget and Blog widget, but the Events widget is set up differently and for the life of me, I can't find a way to truncate or remove the preview text.


Any tips? Much appreciated!

The Forum post is edited by Musik Oct 2 '14
ross Team
ross Oct 2 '14
Ari, do you want to remove/truncate description text of the event in the event widget or title?
Musik
Musik Oct 3 '14
Thanks for the reply, Ross. It's the description text of the event. My end goal is to only display the event thumbnail image, title, timestamp, and host.
ross Team
ross Oct 6 '14
Ari, you need to go here: 


ow_plugins/event/bol/event_service.php


602 line: 



 public function getListingData( array $events )    {        $resultArray = array();
        /* @var $eventItem EVENT_BOL_Event */        foreach ( $events as $eventItem )        {            $title = UTIL_String::truncate(strip_tags($eventItem->getTitle()), 80, "...") ;            $content = UTIL_String::truncate(strip_tags($eventItem->getDescription()), 100, "...");                        $resultArray[$eventItem->getId()] = array(                'content' => $content,                'title' => $title,                'eventUrl' => OW::getRouter()->urlForRoute('event.view', array('eventId' => $eventItem->getId())),                'imageSrc' => ( $eventItem->getImage() ? $this->generateImageUrl($eventItem->getImage(), true) : $this->generateDefaultImageUrl() ),                'imageTitle' => $title            );        }
        return $resultArray;    }



change this line: 

$content = UTIL_String::truncate(strip_tags($eventItem->getDescription()), 100, "...");


like this: 

$content =' ';// UTIL_String::truncate(strip_tags($eventItem->getDescription()), 100, "...");


in order not to have a description


or change the value 100 to the value you want. 


However this modification will influence all listings 

Musik
Musik Oct 6 '14
Thanks, ross. I see what you mean about affecting all listings. I ran into a similar issue when I tried to "hide" the Event widget text via CSS: it also affected forum post text.


I really appreciate the reply. Thanks again!

ross Team
ross Oct 6 '14
To change this behavior of listings is considered as bigger modification. 

Please post a topic in the custom code modification section, probably some community member will assist you with that. 

jess sica
jess sica Dec 29 '23
The Event widget allows users to view upcoming Canapes at parties events quickly and easily. To make the widget easier to read and navigate, users can truncate the text of each event to make the widget more concise. This truncation feature is a great way to make sure that users can quickly find the information they need without having to scroll through long blocks of text.