You are here

function tft_get_folder_menu_links in Taxonomy File Tree 7.2

Return a list of links for the folder menu.

Links include:

  • "go to parent"
  • "reorder elements"

Parameters

int $tid:

Return value

array

Related topics

2 calls to tft_get_folder_menu_links()
tft in includes/tft.pages.inc
Page callback: file content list.
tft_ajax_get_folder in includes/tft.ajax.inc
Page callback: get folder content via AJAX.

File

./tft.module, line 1015
Hook implementations and module logic for TFT.

Code

function tft_get_folder_menu_links($tid) {
  $links = array();
  $parent_tid = tft_get_parent_tid($tid);
  $disabled = FALSE;
  if ($parent_tid >= 0 && $tid != $_SESSION['tft']['root_tid']) {
    if (!tft_term_access($parent_tid)) {
      $disabled = TRUE;
    }
  }
  else {
    $disabled = TRUE;
  }
  $links['parent_folder'] = array(
    'title' => t("parent folder"),
    'href' => 'tft',
    'fragment' => $disabled ? 'tft/0' : "tft/{$parent_tid}",
    'external' => TRUE,
    'attributes' => array(
      'id' => 'tft-back',
      'class' => array(
        'folder-menu-ops-link',
        $disabled ? 'disabled' : 'enabled',
      ),
    ),
  );
  if (user_access(TFT_PERM__REORDER_ITEMS)) {
    $links['reorder_items'] = array(
      'title' => t("reorder elements"),
      'href' => "tft/terms/reorder/{$tid}",
      'attributes' => array(
        'id' => 'manage-folders',
        'class' => array(
          'folder-menu-ops-link',
        ),
      ),
      'query' => array(
        'destination' => (!empty($_SESSION['tft']['q']) ? $_SESSION['tft']['q'] : '') . "#tft/{$tid}",
      ),
    );
  }
  drupal_alter('tft_folder_menu_links', $links, $tid);
  return $links;
}