/** * * Build the UI for the table view * @param Array $data * @param XMLElement $link * @param int $entry_id * @return string - the html of the link */ public function prepareTableValue($data, XMLElement $link = NULL, $entry_id = NULL) { $url = $data['url']; $thumb = $data['thumbnail_url']; $textValue = $this->prepareTextValue($data, $entry_id); $value = NULL; // no url = early exit if (strlen($url) == 0) { return NULL; } // no thumbnail or the parameter is not set ? if (empty($thumb) || $this->get('thumbs') != 'yes') { // if not use the title or the url as value $value = $textValue; } else { // create a image $thumb = ServiceDriver::removeHTTPProtocol($thumb); $thumb = ServiceDriver::removeRelativeProtocol($thumb); $img_path = URL . '/image/1/0/40/1/' . $thumb; $value = '<img src="' . $img_path . '" alt="' . General::sanitize($data['title']) . '" height="40" />'; } // does this cell serve as a link ? if (!!$link) { // if so, set our html as the link's value $link->setValue($value); $link->setAttribute('title', $textValue . ' | ' . $link->getAttribute('title')); } else { // if not, wrap our html with a external link to the resource url $link = new XMLElement('a', $value, array('href' => $url, 'target' => '_blank', 'title' => $textValue)); } // returns the link's html code return $link->generate(); }