You are here

Status.php in Support Ticketing System 8

File

modules/support_ticket/src/Plugin/views/filter/Status.php
View source
<?php

/**
 * @file
 * Contains \Drupal\support_ticket\Plugin\views\filter\Status.
 */
namespace Drupal\support_ticket\Plugin\views\filter;

use Drupal\Core\Form\FormStateInterface;
use Drupal\views\Plugin\views\filter\FilterPluginBase;

/**
 * Filter by published status.
 *
 * @ingroup views_filter_handlers
 *
 * @ViewsFilter("support_ticket_status")
 */
class Status extends FilterPluginBase {
  public function adminSummary() {
  }
  protected function operatorForm(&$form, FormStateInterface $form_state) {
  }
  public function canExpose() {
    return FALSE;
  }
  public function query() {
    $table = $this
      ->ensureMyTable();
    $this->query
      ->addWhereExpression($this->options['group'], "{$table}.status = 1 OR ({$table}.uid = ***CURRENT_USER*** AND ***CURRENT_USER*** <> 0 AND ***VIEW_OWN_UNPUBLISHED_SUPPORT_TICKETS*** = 1) OR ***ADMINISTER_SUPPORT_TICKETS*** = 1");
  }

  /**
   * {@inheritdoc}
   */
  public function getCacheContexts() {
    $contexts = parent::getCacheContexts();
    $contexts[] = 'user';
    return $contexts;
  }

}

Classes

Namesort descending Description
Status Filter by published status.