From fb4947773c664e554fd0432f3ad7729076f9a81a Mon Sep 17 00:00:00 2001 From: Martin Cording Date: Fri, 5 Dec 2014 12:05:41 +0100 Subject: [PATCH 1/2] DDBEASY-217 - Truncate relation descriptions. Signed-off-by: Martin Cording --- ting.entities.inc | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/ting.entities.inc b/ting.entities.inc index 69d5f76..446ba78 100644 --- a/ting.entities.inc +++ b/ting.entities.inc @@ -5,6 +5,8 @@ * Entity classes for ting objects and collections. */ +define('TING_OBJ_DESCRIPTION_LENGTH', 180); + /** * Object representing a relation between TingEntites. */ @@ -325,6 +327,17 @@ class TingEntity extends DingEntity { function getDescription() { return !empty($this->reply->record['dc:description'][''][0]) ? $this->reply->record['dc:description'][''][0] : FALSE; + $description = FALSE; + if (!empty($this->reply->record['dc:description'][''][0])) { + $description = $this->reply->record['dc:description'][''][0]; + if (drupal_strlen($description) > TING_OBJ_DESCRIPTION_LENGTH) { + $description = truncate_utf8($description, TING_OBJ_DESCRIPTION_LENGTH, TRUE, TRUE); + } + else { + $description .= t('...'); + } + } + return $description; } /** From 3c4dc0dcaed6742eca2ae7f91f667b47be26443a Mon Sep 17 00:00:00 2001 From: Martin Cording Date: Wed, 4 Mar 2015 10:14:48 +0100 Subject: [PATCH 2/2] DDBEASY-217 - Forgot to remove original return. Signed-off-by: Martin Cording --- ting.entities.inc | 1 - 1 file changed, 1 deletion(-) diff --git a/ting.entities.inc b/ting.entities.inc index 446ba78..5efafba 100644 --- a/ting.entities.inc +++ b/ting.entities.inc @@ -326,7 +326,6 @@ class TingEntity extends DingEntity { } function getDescription() { - return !empty($this->reply->record['dc:description'][''][0]) ? $this->reply->record['dc:description'][''][0] : FALSE; $description = FALSE; if (!empty($this->reply->record['dc:description'][''][0])) { $description = $this->reply->record['dc:description'][''][0];