class InviteParamConverter in Invite 8
Class InviteParamConverter.
Hierarchy
- class \Drupal\invite\ParamConverter\InviteParamConverter implements ParamConverterInterface
Expanded class hierarchy of InviteParamConverter
1 string reference to 'InviteParamConverter'
1 service uses InviteParamConverter
File
- src/
ParamConverter/ InviteParamConverter.php, line 12
Namespace
Drupal\invite\ParamConverterView source
class InviteParamConverter implements ParamConverterInterface {
/**
* Applies function.
*/
public function applies($definition, $name, Route $route) {
return !empty($definition['type']) && $definition['type'] == 'reg_code';
}
/**
* Converts reg_code to invite.
*/
public function convert($reg_code, $definition, $name, array $defaults) {
$invite = \Drupal::entityQuery('invite')
->condition('reg_code', $reg_code)
->execute();
return Invite::load(reset($invite));
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
InviteParamConverter:: |
public | function |
Applies function. Overrides ParamConverterInterface:: |
|
InviteParamConverter:: |
public | function |
Converts reg_code to invite. Overrides ParamConverterInterface:: |