1.20.x views_handler_filter_entity_bundle.inc | views_handler_filter_entity_bundle::get_entity_type() |
Set and returns the entity_type.
Return value
string: The entity type on the filter.
File
- modules/
views/ handlers/ views_handler_filter_entity_bundle.inc, line 35 - Definition of views_handler_filter_entity_bundle
Class
- views_handler_filter_entity_bundle
- Filter class which allows to filter by certain bundles of an entity.
Code
function get_entity_type() {
if (!isset($this->entity_type)) {
$data = views_fetch_data($this->table);
if (isset($data['table']['entity type'])) {
$this->entity_type = $data['table']['entity type'];
}
// If the current filter is under a relationship you can't be sure that the
// entity type of the view is the entity type of the current filter
// For example a filter from a node author on a node view does have users as entity type.
if (!empty($this->options['relationship']) && $this->options['relationship'] != 'none') {
$relationships = $this->view->display_handler->get_option('relationships');
if (!empty($relationships[$this->options['relationship']])) {
$options = $relationships[$this->options['relationship']];
$data = views_fetch_data($options['table']);
$this->entity_type = $data['table']['entity type'];
}
}
}
return $this->entity_type;
}