You are here

private function GatherContentCurl::getTreeList in GatherContent 7.2

Return list of pages.

1 call to GatherContentCurl::getTreeList()
GatherContentCurl::pageOverwriteDropdown in includes/curl.inc
Return dropdown for page list to overwrite.

File

includes/curl.inc, line 367
Contains functions used to process and retrieve data from GatherContent.

Class

GatherContentCurl
@file Contains functions used to process and retrieve data from GatherContent.

Code

private function getTreeList() {
  if (isset($this->data['tree_list'])) {
    return $this->data['tree_list'];
  }
  $html = '';
  foreach ($this->post_types as $name => $title) {
    $nodes = db_select('node')
      ->fields('node', array(
      'nid',
      'title',
    ))
      ->condition('type', $name, '=')
      ->execute()
      ->fetchAllKeyed();
    foreach ($nodes as $id => $node) {
      if (empty($node)) {
        $node = t('(no title)');
      }
      $title_text = $node;
      if (strlen($title_text) > 30) {
        $title_text = substr($title_text, 0, 30) . '...';
      }
      $html .= '
    <li data-post-type="' . $name . '"><a href="#" data-value="' . $id . '" title="' . check_plain($node) . '">';
      $html .= $title_text . '</a></li>';
    }
  }
  $this->data['tree_list'] = $html;
  return $this->data['tree_list'];
}