MassContactConfirmConverter.php in Mass Contact 8
File
src/ParamConverter/MassContactConfirmConverter.php
View source
<?php
namespace Drupal\mass_contact\ParamConverter;
use Drupal\user\PrivateTempStoreFactory;
use Symfony\Component\Routing\Route;
use Drupal\Core\ParamConverter\ParamConverterInterface;
class MassContactConfirmConverter implements ParamConverterInterface {
protected $tempStoreFactory;
public function __construct(PrivateTempStoreFactory $temp_store_factory) {
$this->tempStoreFactory = $temp_store_factory;
}
public function convert($value, $definition, $name, array $defaults) {
$store = $this->tempStoreFactory
->get('mass_contact_confirm_info');
if ($mass_contact_message_info = $store
->get($value)) {
return $mass_contact_message_info;
}
}
public function applies($definition, $name, Route $route) {
if (!empty($definition['type']) && $definition['type'] == 'mass_contact_confirm_info') {
return TRUE;
}
return FALSE;
}
}