You are here

class SmsRouteEnhancer in SMS Framework 8

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

Route enhancer for SMS Framework.

Hierarchy

Expanded class hierarchy of SmsRouteEnhancer

1 string reference to 'SmsRouteEnhancer'
sms.services.yml in ./sms.services.yml
sms.services.yml
1 service uses SmsRouteEnhancer
sms.route_enhancer in ./sms.services.yml
Drupal\sms\Routing\Enhancer\SmsRouteEnhancer

File

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

Namespace

Drupal\sms\Routing\Enhancer
View source
class SmsRouteEnhancer implements EnhancerInterface {

  /**
   * {@inheritdoc}
   */
  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;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
SmsRouteEnhancer::enhance public function Update the defaults based on its own data and the request.