public function getCategories() {
    // Define as array.
    $options = [];
    // Fetch main categories.
    foreach ($this->termStorage->loadTree('social_tagging', 0, 1) as $category) {
      $options[$category->tid] = $category->name;
    }
    // Return array.
    return $options;
  }
public function getCategories() {
    // Define as array.
    $options = [];
    // Fetch main categories.
    foreach ($this->termStorage->loadTree('social_tagging', 0, 1) as $category) {
      $options[$category->tid] = $category->name;
    }
    // Return array.
    return $options;
  }
public function getCategories ( ) { // Define as array. $ options = [ ] ; // Fetch main categories. foreach ( $ this -> termStorage -> loadTree ( 'social_tagging' , 0 , 1 ) as $ category ) { $ options [ $ category -> tid ] = $ category -> name ; } // Return array. return $ options ; }
Returns all the top level term items, that are considered categories.

@return array
An array of top level category items.
Returns all the top level term items that are considered categories .