function tft_operation_links in Taxonomy File Tree 7
Format the operation links and check user access.
Parameters
string $type: The type of operation links. Can be 'folder' or 'file'
int $id: Either the taxonomy term tid or the node nid
stdClass $node = NULL: An optional node object. Used to check against node_access()
Return value
string HTML string with operation links
1 call to tft_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 899 - Module hooks.
Code
function tft_operation_links($type, $id, $node = NULL, $og_nid = NULL) {
$html = '';
switch ($type) {
case 'folder':
// Hide edit link if the user has no access
if (tft_menu_access(TFT_ADD_TERMS, $og_nid)) {
$edit = TRUE;
$html .= l(t("edit"), "tft/term/edit/{$id}", array(
'attributes' => array(
'class' => 'ops-link term-edit-link',
),
'query' => array(
'destination' => $_SESSION['tft']['q'],
),
));
}
if (tft_menu_access(TFT_DELETE_TERMS, $og_nid)) {
$delete = TRUE;
if ($edit) {
$html .= ' | ';
}
$html .= l(t("delete"), "tft/term/delete/{$id}", array(
'attributes' => array(
'class' => 'ops-link term-edit-link',
),
'query' => array(
'destination' => $_SESSION['tft']['q'],
),
));
}
// We must be in the OG context to archive.
/*if (tft_menu_access(TFT_ARCHIVE_TERMS)) {
if ($delete) {
$html .= ' | ';
}
if (!tft_is_term_archived($id)) {
$html .= l(t("archiver"), "tft/term/archive/$id", array('attributes' => array('class' => 'ops-link term-edit-link'), 'query' => array('destination' => $_SESSION['tft']['q'])));
}
else {
$html .= l(t("restaurer"), "og/$og_nid/tft/term/restore/$id", array('attributes' => array('class' => 'ops-link term-edit-link'), 'query' => array('destination' => $_SESSION['tft']['q'])));
}
}*/
break;
case 'file':
// Hide edit link if the user has no access
if (node_access('update', $node)) {
$html .= l(t("edit"), "node/{$id}/edit", array(
'attributes' => array(
'class' => 'ops-link node-edit-link',
),
'query' => array(
'destination' => $_SESSION['tft']['q'],
),
)) . ' | ';
}
$html .= l(t("more info"), "node/{$id}", array(
'attributes' => array(
'class' => 'ops-link',
),
));
// We must be in the OG context to archive.
/*if (tft_menu_access(TFT_ARCHIVE_TERMS)) {
$html .= ' | ';
if (!tft_is_file_archived($id)) {
$html .= l(t("archiver"), "tft/file/archive/$id", array('attributes' => array('class' => 'ops-link term-edit-link'), 'query' => array('destination' => $_SESSION['tft']['q'])));
}
else {
$html .= l(t("restaurer"), "og/$og_nid/tft/file/restore/$id", array('attributes' => array('class' => 'ops-link term-edit-link'), 'query' => array('destination' => $_SESSION['tft']['q'])));
}
}*/
break;
}
return $html;
}