1 views_handler_filter_node_hidden_path.inc public views_handler_filter_node_hidden_path::query()

Add this filter to the query.

Due to the nature of fapi, the value and the operator have an unintended level of indirection. You will find them in $this->operator and $this->value respectively.

Overrides views_handler_filter_boolean_operator::query

File

core/modules/node/views/views_handler_filter_node_hidden_path.inc, line 22
Definition of views_handler_filter_node_hidden_path.

Class

views_handler_filter_node_hidden_path
Filter by content type's hidden path setting.

Code

public function query() {
  $table = $this->ensure_my_table();
  $node_types = node_type_get_types();

  $enabled_types = array_filter($node_types, function($val) {
    return $val->settings['hidden_path'];
  });

  $diff_types = $enabled_types;
  if (!$this->value) {
    $diff_types = array_diff_key($node_types, $enabled_types);
  }

  // No content type has the hidden_path setting turned on, no need to extend
  // the query.
  if (empty($diff_types)) {
    return;
  }

  $types_names = array_map(function($val) {
    return $val->type;
  }, $diff_types);

  $this->query->add_where_expression($this->options['group'], "$table.type IN (:types)", array(':types' => $types_names));
}