You are here

function other_view_filter_handler_filter_view::get_entity_type in OtherView Filter 7

Set and returns the entity_type.

Return value

string The entity type on the filter.

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

File

./other_view_filter_handler_filter_view.inc, line 57
Definition of views_handler_filter_entity_other_view filter.

Class

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

Code

function get_entity_type() {
  if (isset($this->entity_type)) {
    return $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;
}