function lingotek_views_handler_workbench_link::render in Lingotek Translation 7.4
Same name and namespace in other branches
- 7.5 lingotek_views_handler_workbench_link.inc \lingotek_views_handler_workbench_link::render()
- 7.6 lingotek_views_handler_workbench_link.inc \lingotek_views_handler_workbench_link::render()
Render the field.
Parameters
array $values: The values retrieved from the database.
Overrides views_handler_field::render
File
- ./
lingotek_views_handler_workbench_link.inc, line 35
Class
- lingotek_views_handler_workbench_link
- A handler to link to the Lingotek Workbench.
Code
function render($values) {
global $language;
$entity_type = $this->view->base_table;
if ($entity_type == 'node') {
$entity = node_load($values->nid);
}
elseif ($entity_type == 'comment') {
$entity = comment_load($values->cid);
}
if (!user_access('manage projects') && !user_access('translation')) {
return;
//do not show if the user does not have correct permissions
}
if ($language->language == $entity->language) {
return;
}
drupal_add_css(drupal_get_path('module', 'lingotek') . '/style/workbench-link.css', array(
'group' => CSS_DEFAULT,
));
$text = '<img src="' . base_path() . drupal_get_path('module', 'lingotek') . '/images/ico_chevs_dd.png" >';
$url = 'node/' . $values->nid . '/lingotekworkbench/' . Lingotek::convertDrupal2Lingotek($language->language);
return l($text, $url, array(
'attributes' => array(
'target' => '_blank',
'title' => 'Edit this translation',
'class' => 'lingotek-translation-link',
),
'html' => TRUE,
));
}