function views_handler_filter_entity_bundle::get_entity_type

Set and returns the entity_type.

Return value

string The entity type on the filter.

1 call to views_handler_filter_entity_bundle::get_entity_type()
views_handler_filter_entity_bundle::init in handlers/views_handler_filter_entity_bundle.inc
Provide some extra help to get the operator/value easier to use.

File

handlers/views_handler_filter_entity_bundle.inc, line 39

Class

views_handler_filter_entity_bundle
Filter class which allows to filter by certain bundles of an entity.

Code

public 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;
}