You are here

function lingotek_get_entity_edit_link in Lingotek Translation 7.7

Same name and namespace in other branches
  1. 7.5 lingotek.bulk_grid.inc \lingotek_get_entity_edit_link()
  2. 7.6 lingotek.bulk_grid.inc \lingotek_get_entity_edit_link()
1 call to lingotek_get_entity_edit_link()
lingotek_render_actions in ./lingotek.bulk_grid.inc

File

./lingotek.bulk_grid.inc, line 2719

Code

function lingotek_get_entity_edit_link($entity_properties, $entity_id, $url_only = FALSE) {
  $entity_type = $entity_properties['type'];
  $edit_link = "";
  $query = array();
  $query['destination'] = 'admin/settings/lingotek/manage/' . $entity_type;
  switch ($entity_type) {
    case 'fieldable_panels_pane':
      $edit_link = 'admin/structure/fieldable-panels-panes/view/' . $entity_id . '/edit';
      break;
    case 'taxonomy_term':
      $edit_link = 'taxonomy/term/' . $entity_id . '/edit';
      break;
    case 'message_type':
      return '';
    case 'menu_link':
      $edit_link = 'admin/structure/menu/item/' . $entity_id;
      break;
    case 'paragraphs_item':
      list($parent_id, $parent_title) = lingotek_get_paragraph_parent_info($entity_type, $entity_id);
      $edit_link = 'node' . '/' . $parent_id . '/edit';
      break;
    case 'commerce_product':
      $edit_link = 'admin/commerce/products/' . $entity_id;
      break;
    default:
      $edit_link = $entity_type . '/' . $entity_id . '/edit';
      break;
  }
  return $url_only ? url($edit_link, array(
    'query' => $query,
  )) : l('<i title="' . t('Edit') . '" class="fa fa-edit"></i>', $edit_link, array(
    'html' => TRUE,
    'attributes' => array(
      'target' => '_blank',
    ),
    'query' => $query,
  ));

  // Coder review error: we only want to translate "Edit"
}