You are here

function node_clone_action_link_title in Node clone 8

Menu title callback.

File

./node_clone.module, line 39
Allow users to make a copy of an item of content (a node) and then edit that copy.

Code

function node_clone_action_link_title($node) {

  // A hack to present a shorter title in contextual links.
  if (\Drupal\Core\Url::fromRoute("<current>")
    ->toString() != 'node/' . $node->nid) {
    return t('Clone');
  }
  if (\Drupal::config('node_clone.settings')
    ->get('node_clone_use_node_type_name')) {
    return t('Clone this !type', array(
      '!type' => \Drupal\Component\Utility\Unicode::strtolower(node_type_get_name($node)),
    ));
  }
  return t('Clone content');
}