You are here

public function GatherContentCurl::getProjectsDropdown in GatherContent 7.2

Get project dropdown.

File

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

Class

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

Code

public function getProjectsDropdown() {
  $html = '';
  $url = url('admin/config/content/gathercontent/set_project_id/');
  $project_id = variable_get('gathercontent_project_id');
  $title = '';
  if ($this
    ->foreachSafe($this->data['projects'])) {
    foreach ($this->data['projects'] as $id => $info) {
      if ($id == $project_id) {
        $title = $info['name'];
      }
      else {
        $html .= '
          <li>
            <a href="' . $url . $id . '">' . $info['name'] . '</a>
          </li>';
      }
    }
    if ($html != '') {
      $html = $this
        ->dropdownHtml('<span>' . $title . '</span>', $html);
    }
  }
  $this->data['projects_dropdown'] = $html;
}