You are here

public function GatherContentCurl::getPostTypes in GatherContent 7.2

List post types.

File

includes/curl.inc, line 241
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 getPostTypes() {
  $post_types = node_type_get_types();
  $html = '';
  $default = '';
  $new_post_types = array();
  foreach ($post_types as $type => $info) {
    if ($default == '') {
      $default = $type;
    }
    $options = menu_parent_options(menu_get_menus(), $type, $type);
    if (!empty($options)) {
      $this->hierarchical[$type] = TRUE;
    }
    if ($info->has_title == TRUE) {
      $this->hasTitles[$type] = $info->title_label;
    }
    $html .= '
      <li>
        <a data-value="' . check_plain($type) . '" href="#">' . $info->name . '</a>
      </li>';
    $new_post_types[$type] = $info->name;
  }
  $this->post_types = $new_post_types;
  $this->data['post_types_dropdown'] = $html;
  $this->default_post_type = $default;
}