function _shs_entityreference_views_get_vocabularies in Simple hierarchical select 7
Helper function to get the vocabularies used in entityreference views.
Parameters
string $view_name: Name of view.
string $display_id: Name of display.
return string[] List of vocabulary identifiers.
2 calls to _shs_entityreference_views_get_vocabularies()
- shs_field_widget_form in ./
shs.module - Implements hook_field_widget_form().
- shs_handler_filter_entityreference::value_form in includes/
handlers/ shs_handler_filter_entityreference.inc - Provide a simple textfield for equality.
File
- ./
shs.module, line 1203 - Provides an additional widget for term fields to create hierarchical selects.
Code
function _shs_entityreference_views_get_vocabularies($view_name, $display_id) {
$view = views_get_view($view_name);
if (empty($view)) {
// Failed to load view.
return array();
}
$filters = $view
->get_items('filter', $display_id);
$vocabularies = array();
foreach ($filters as $key => $filter) {
if ('taxonomy_vocabulary' !== $filter['table'] || 'machine_name' !== $key) {
continue;
}
$vocabularies = array_keys($filter['value']) + $vocabularies;
}
return $vocabularies;
}