public function getCategoryOptions() {
    static $options = [];
    $program = $this->state['program'];

    if (!$options) {
      $options = ['all' => $this->t('All')];
      $query = $this->entityQuery
        ->get('node')
        ->condition('status', 1)
        ->condition('type', 'program_subcategory')
        ->sort('title');
      if ($program && $program !== 'all') {
        $query->condition('field_category_program', $program);
      }
      $entity_ids = $query->execute();

      $nodes = $this->entityTypeManager->getStorage('node')->loadMultiple($entity_ids);
      foreach ($entity_ids as $id) {
        $options[$id] = $nodes[$id]->getTitle();
      }
    }

    return $options;
  }
public function getCategoryOptions() {
    static $options = [];
    $program = $this->state['program'];

    if (!$options) {
      $options = ['all' => $this->t('All')];
      $query = $this->entityQuery
        ->get('node')
        ->condition('status', 1)
        ->condition('type', 'program_subcategory')
        ->sort('title');
      if ($program && $program !== 'all') {
        $query->condition('field_category_program', $program);
      }
      $entity_ids = $query->execute();

      $nodes = $this->entityTypeManager->getStorage('node')->loadMultiple($entity_ids);
      foreach ($entity_ids as $id) {
        $options[$id] = $nodes[$id]->getTitle();
      }
    }

    return $options;
  }
public function getCategoryOptions ( ) { static $ options = [ ] ; $ program = $ this -> state [ 'program' ] ; if ( ! $ options ) { $ options = [ 'all' => $ this -> t ( 'All' ) ] ; $ query = $ this -> entityQuery -> get ( 'node' ) -> condition ( 'status' , 1 ) -> condition ( 'type' , 'program_subcategory' ) -> sort ( 'title' ) ; if ( $ program && $ program !== 'all' ) { $ query -> condition ( 'field_category_program' , $ program ) ; } $ entity_ids = $ query -> execute ( ) ; $ nodes = $ this -> entityTypeManager -> getStorage ( 'node' ) -> loadMultiple ( $ entity_ids ) ; foreach ( $ entity_ids as $ id ) { $ options [ $ id ] = $ nodes [ $ id ] -> getTitle ( ) ; } } return $ options ; }
Helper method retrieving category options.

@return array
Array of time options to be used in form element.
Helper method retrieving category options .