views_handler_field_node_link_clone.php in Node clone 8
File
src/views_handler_field_node_link_clone.php
View source
<?php
namespace Drupal\node_clone;
class views_handler_field_node_link_clone extends views_handler_field_node_link {
function render_link($node, $values) {
if (!node_clone_access_cloning($node)) {
return;
}
$this->options['alter']['make_link'] = TRUE;
$this->options['alter']['path'] = "node/{$node->nid}/clone/" . node_clone_get_token($node->nid);
$destination = drupal_get_destination();
if ($method == 'prepopulate') {
$this->options['alter']['query'] = $destination;
}
elseif (!empty($destination['destination'])) {
$this->options['alter']['query']['node-clone-destination'] = $destination['destination'];
}
$text = !empty($this->options['text']) ? $this->options['text'] : t('clone');
return $text;
}
}