public function PhotosImageSearch::getAlbumNames in Album Photos 8.5
Same name and namespace in other branches
- 6.0.x src/Plugin/Search/PhotosImageSearch.php \Drupal\photos\Plugin\Search\PhotosImageSearch::getAlbumNames()
Get all albums for advanced search.
Return value
array Array of nid and album title.
1 call to PhotosImageSearch::getAlbumNames()
- PhotosImageSearch::searchFormAlter in src/
Plugin/ Search/ PhotosImageSearch.php - Alters the search form when being built for a given plugin.
File
- src/
Plugin/ Search/ PhotosImageSearch.php, line 687
Class
- PhotosImageSearch
- Handles searching for photos_image entities using the Search module index.
Namespace
Drupal\photos\Plugin\SearchCode
public function getAlbumNames() {
$options = [];
$results = $this->database
->select('node_field_data', 'n')
->fields('n', [
'nid',
'title',
])
->condition('type', 'photos')
->condition('status', 1)
->addTag('node_access')
->execute();
foreach ($results as $result) {
$options[$result->nid] = $result->title;
}
return $options;
}