Stid.php in Support Ticketing System 8
File
modules/support_ticket/src/Plugin/views/argument/Stid.php
View source
<?php
namespace Drupal\support_ticket\Plugin\views\argument;
use Drupal\Component\Utility\SafeMarkup;
use Drupal\support_ticket\SupportTicketStorageInterface;
use Drupal\views\Plugin\views\argument\NumericArgument;
use Symfony\Component\DependencyInjection\ContainerInterface;
class Stid extends NumericArgument {
protected $supportTicketStorage;
public function __construct(array $configuration, $plugin_id, $plugin_definition, SupportTicketStorageInterface $support_ticket_storage) {
parent::__construct($configuration, $plugin_id, $plugin_definition);
$this->supportTicketStorage = $support_ticket_storage;
}
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
return new static($configuration, $plugin_id, $plugin_definition, $container
->get('entity.manager')
->getStorage('support_ticket'));
}
public function titleQuery() {
$titles = array();
$support_tickets = $this->supportTicketStorage
->loadMultiple($this->value);
foreach ($support_tickets as $support_ticket) {
$titles[] = SafeMarkup::checkPlain($support_ticket
->label());
}
return $titles;
}
}
Classes
Name |
Description |
Stid |
Argument handler to accept a support ticket id. |