function tvi_get_view_displays in Taxonomy Views Integrator 8
Same name and namespace in other branches
- 6 includes/tvi.admin.inc \tvi_get_view_displays()
- 7 includes/tvi.admin.inc \tvi_get_view_displays()
Return an array of displays for a given view id.
Parameters
string $view_id: The view id to get values from.
Return value
array Option values with display name and id.
1 call to tvi_get_view_displays()
- _tvi_settings_form in ./
tvi.module - Helper function to construct the forms for both term and vocab edit forms.
File
- ./
tvi.module, line 235 - Allow views to be used instead of default taxonomy term page behavior.
Code
function tvi_get_view_displays(string $view_id) {
$display_options = [];
$view = Drupal::entityTypeManager()
->getStorage('view')
->load($view_id);
if ($view) {
foreach ($view
->get('display') as $display) {
$display_options[$display['id']] = $display['display_title'] . ' (' . $display['display_plugin'] . ')';
}
}
return $display_options;
}