support-2.0.x-dev/modules/support_ticket/src/Plugin/views/filter/Status.php

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

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 {

  /**
   * Admin summary method.
   *
   * @todo what is this for.
   */
  public function adminSummary() {
  }

  /**
   * Operator Form method.
   *
   * @todo what is this for.
   *
   * @param array $form
   *   Form array.
   * @param \Drupal\Core\Form\FormStateInterface $form_state
   *   Form state.
   */
  protected function operatorForm(&$form, FormStateInterface $form_state) {
    
  }

  /**
   * Can expose the issue.
   *
   * @todo what is this for.
   *
   * @return bool
   *   returns our boolean value.
   */
  public function canExpose() {
    return FALSE;
  }

  /**
   * Getting query for current user.
   */
  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;
  }

}

Главная | Обратная связь

drupal hosting | друпал хостинг | it patrol .inc