You are here

function views_handler_filter_valid_fia::query in Facebook Instant Articles 7.2

Same name and namespace in other branches
  1. 7 modules/fb_instant_articles_views/views/handler/views_handler_filter_valid_fia.inc \views_handler_filter_valid_fia::query()

Add this filter to the query.

Overrides views_handler_filter::query

File

modules/fb_instant_articles_views/views/handler/views_handler_filter_valid_fia.inc, line 57
Contains views_handler_filter_valid_fia.

Class

views_handler_filter_valid_fia
Simple filter that checks if a node implements the FIA custom view mode

Code

function query() {

  // Get entity_info for nodes.
  $field = 'node.' . $this->real_field;
  if ($entity_types = fb_instant_articles_display_get_article_entity_types()) {
    $node_types = array_keys($entity_types['node']);
    if (count($node_types) > 0) {

      /**
       * Only set the value and operator if we have some valid node types, so
       * that we don't break the query.  Leaving them as they are will result
       * in an empty query, which is good
       */
      $this->query
        ->add_where($this->options['group'], $field, $node_types, 'IN');
    }
  }
}