You are here

public function SmsRouteEnhancer::enhance in SMS Framework 8

Same name and namespace in other branches
  1. 2.x src/Routing/Enhancer/SmsRouteEnhancer.php \Drupal\sms\Routing\Enhancer\SmsRouteEnhancer::enhance()
  2. 2.1.x src/Routing/Enhancer/SmsRouteEnhancer.php \Drupal\sms\Routing\Enhancer\SmsRouteEnhancer::enhance()

File

src/Routing/Enhancer/SmsRouteEnhancer.php, line 18

Class

SmsRouteEnhancer
Route enhancer for SMS Framework.

Namespace

Drupal\sms\Routing\Enhancer

Code

public function enhance(array $defaults, Request $request) {
  $route = $defaults[RouteObjectInterface::ROUTE_OBJECT];
  if (!$route
    ->hasDefault('_sms_gateway_push_endpoint')) {
    return $defaults;
  }
  $gateway_id = $defaults['_sms_gateway_push_endpoint'];
  $defaults['sms_gateway'] = SmsGateway::load($gateway_id);
  return $defaults;
}