You are here

function tft_folder_list in Taxonomy File Tree 7

File

./tft.module, line 1145
Module hooks.

Code

function tft_folder_list($tid = 0) {
  $list = array();
  $elements = tft_folder_content($tid);
  foreach ($elements as $element) {
    if ($element['type'] == 'term') {
      if (tft_term_access($element['id'])) {
        $list[] = array(
          'tid' => $element['id'],
          'name' => db_query("SELECT name FROM {taxonomy_term_data} WHERE tid = :tid", array(
            ':tid' => $element['id'],
          ))
            ->fetchField(),
          'weight' => $element['weight'],
          'type' => $element['type'],
        );
      }
    }
    else {
      $node = node_load($element['id']);
      if (node_access('view', $node)) {
        $list[] = array(
          'nid' => $element['id'],
          'name' => check_plain($node->title),
          'weight' => $element['weight'],
          'type' => $element['type'],
        );
      }
    }
  }
  return $list;
}