class SupportTicketPreviewConverter in Support Ticketing System 8
Same name in this branch
- 8 modules/support_ticket/src/ParamConverter/SupportTicketPreviewConverter.php \Drupal\support_ticket\ParamConverter\SupportTicketPreviewConverter
- 8 modules/support_ticket/src/ProxyClass/ParamConverter/SupportTicketPreviewConverter.php \Drupal\support_ticket\ProxyClass\ParamConverter\SupportTicketPreviewConverter
Provides upcasting for a support ticket entity in preview.
Hierarchy
- class \Drupal\support_ticket\ParamConverter\SupportTicketPreviewConverter implements ParamConverterInterface
Expanded class hierarchy of SupportTicketPreviewConverter
1 string reference to 'SupportTicketPreviewConverter'
- support_ticket.services.yml in modules/
support_ticket/ support_ticket.services.yml - modules/support_ticket/support_ticket.services.yml
1 service uses SupportTicketPreviewConverter
File
- modules/
support_ticket/ src/ ParamConverter/ SupportTicketPreviewConverter.php, line 18 - Contains \Drupal\support_ticket\ParamConverter\SupportTicketPreviewConverter.
Namespace
Drupal\support_ticket\ParamConverterView source
class SupportTicketPreviewConverter implements ParamConverterInterface {
/**
* Stores the tempstore factory.
*
* @var \Drupal\user\PrivateTempStoreFactory
*/
protected $tempStoreFactory;
/**
* Constructs a new SupportTicketPreviewConverter.
*
* @param \Drupal\user\PrivateTempStoreFactory $temp_store_factory
* The factory for the temp store object.
*/
public function __construct(PrivateTempStoreFactory $temp_store_factory) {
$this->tempStoreFactory = $temp_store_factory;
}
/**
* {@inheritdoc}
*/
public function convert($value, $definition, $name, array $defaults) {
$store = $this->tempStoreFactory
->get('support_ticket_preview');
if ($form_state = $store
->get($value)) {
return $form_state
->getFormObject()
->getEntity();
}
}
/**
* {@inheritdoc}
*/
public function applies($definition, $name, Route $route) {
if (!empty($definition['type']) && $definition['type'] == 'support_ticket_preview') {
return TRUE;
}
return FALSE;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
SupportTicketPreviewConverter:: |
protected | property | Stores the tempstore factory. | |
SupportTicketPreviewConverter:: |
public | function |
Determines if the converter applies to a specific route and variable. Overrides ParamConverterInterface:: |
|
SupportTicketPreviewConverter:: |
public | function |
Converts path variables to their corresponding objects. Overrides ParamConverterInterface:: |
|
SupportTicketPreviewConverter:: |
public | function | Constructs a new SupportTicketPreviewConverter. |