function tft_item_operation_links in Taxonomy File Tree 7.2
Returns a list of operation links for the given item.
Parameters
string $type: The type of operation links. Can be 'folder' or 'file'.
int $id: Either the taxonomy term tid or the node nid.
int $parent_tid = NULL:
Return value
array
Related topics
1 call to tft_item_operation_links()
- tft_get_content in ./
tft.module - Get the folder content and return it in an array form for the theme_table call.
File
- ./
tft.module, line 689 - Hook implementations and module logic for TFT.
Code
function tft_item_operation_links($type, $id, $parent_tid = NULL) {
$links = array();
$query = isset($_SESSION['tft']['q']) ? $_SESSION['tft']['q'] : '';
switch ($type) {
case 'folder':
if (tft_term_access($id, NULL, 'edit')) {
$links['edit'] = array(
'title' => t("edit"),
'href' => "tft/term/edit/{$id}",
'attributes' => array(
'class' => 'ops-link term-edit-link',
),
'query' => array(
'destination' => $query . (isset($parent_tid) ? "#tft/{$parent_tid}" : ''),
),
);
}
if (tft_term_access($id, NULL, 'delete')) {
$links['delete'] = array(
'title' => t("delete"),
'href' => "tft/term/delete/{$id}",
'attributes' => array(
'class' => 'ops-link term-edit-link',
),
'query' => array(
'destination' => $query . (isset($parent_tid) ? "#tft/{$parent_tid}" : ''),
),
);
}
break;
case 'file':
$node = node_load($id);
if (node_access('update', $node)) {
$links['edit'] = array(
'title' => t("edit"),
'href' => "node/{$id}/edit",
'attributes' => array(
'class' => 'ops-link node-edit-link',
),
'query' => array(
'destination' => $query . (isset($parent_tid) ? "#tft/{$parent_tid}" : ''),
),
);
}
$links['view'] = array(
'title' => t("more info"),
'href' => "node/{$id}",
'attributes' => array(
'class' => 'ops-link',
),
);
break;
}
drupal_alter('tft_item_operation_links', $links, $type, $id, $parent_tid);
return $links;
}