function tft_archive_tft_item_operation_links_alter in Taxonomy File Tree 7.2
Implements hook_tft_item_operation_links_alter().
File
- modules/
tft_archive/ tft_archive.module, line 84 - Hook implementation and logic.
Code
function tft_archive_tft_item_operation_links_alter(&$links, $type, $id, $parent_tid) {
$query = isset($_SESSION['tft']['q']) ? $_SESSION['tft']['q'] : '';
if ($type == 'folder') {
if (tft_term_access($id, NULL, 'archive') && !tft_archive_is_archive_folder($id)) {
if (tft_archive_element_is_archived($id, 'term')) {
$links['restore'] = array(
'title' => t("restore"),
'href' => "tft/term/restore/{$id}",
'attributes' => array(
'class' => 'ops-link term-restore-link',
),
'query' => array(
'destination' => $query . (isset($parent_tid) ? "#tft/{$parent_tid}" : ''),
),
);
}
else {
$links['archive'] = array(
'title' => t("archive"),
'href' => "tft/term/archive/{$id}",
'attributes' => array(
'class' => 'ops-link term-archive-link',
),
'query' => array(
'destination' => $query . (isset($parent_tid) ? "#tft/{$parent_tid}" : ''),
),
);
}
}
}
else {
if (isset($links['edit']) && tft_term_access($parent_tid, NULL, 'archive')) {
if (tft_archive_element_is_archived($id, 'node')) {
$links['restore'] = array(
'title' => t("restore"),
'href' => "tft/file/restore/{$id}",
'attributes' => array(
'class' => 'ops-link term-restore-link',
),
'query' => array(
'destination' => $query . (isset($parent_tid) ? "#tft/{$parent_tid}" : ''),
),
);
}
else {
$links['archive'] = array(
'title' => t("archive"),
'href' => "tft/file/archive/{$id}",
'attributes' => array(
'class' => 'ops-link term-archive-link',
),
'query' => array(
'destination' => $query . (isset($parent_tid) ? "#tft/{$parent_tid}" : ''),
),
);
}
}
}
}