public function getLocations() {
    $data = [];

    $location_ids = $this->queryFactory->get('node')
      ->condition('type', 'branch')
      ->execute();

    if (!$location_ids) {
      return [];
    }

    $storage = $this->entityTypeManager->getStorage('node');
    $locations = $storage->loadMultiple($location_ids);

    foreach ($locations as $location) {
      $data[$location->id()] = [
        'title' => $location->label(),
      ];
    }

    return $data;
  }
public function getLocations() {
    $data = [];

    $location_ids = $this->queryFactory->get('node')
      ->condition('type', 'branch')
      ->execute();

    if (!$location_ids) {
      return [];
    }

    $storage = $this->entityTypeManager->getStorage('node');
    $locations = $storage->loadMultiple($location_ids);

    foreach ($locations as $location) {
      $data[$location->id()] = [
        'title' => $location->label(),
      ];
    }

    return $data;
  }
public function getLocations ( ) { $ data = [ ] ; $ location_ids = $ this -> queryFactory -> get ( 'node' ) -> condition ( 'type' , 'branch' ) -> execute ( ) ; if ( ! $ location_ids ) { return [ ] ; } $ storage = $ this -> entityTypeManager -> getStorage ( 'node' ) ; $ locations = $ storage -> loadMultiple ( $ location_ids ) ; foreach ( $ locations as $ location ) { $ data [ $ location -> id ( ) ] = [ 'title' => $ location -> label ( ) , ] ; } return $ data ; }
Get the list of locations.

@return array
The list of locations keyed by location ID.
Get the list of locations .