Ejemplo n.º 1
0
 /**
  * {@inheritdoc}
  */
 static function courierContextCC($entity_type, $operation)
 {
     $event_types = \Drupal::service('rng.event_manager')->eventTypeWithEntityType($entity_type);
     if (!count($event_types)) {
         $courier_context = CourierContext::load('rng_registration_' . $entity_type);
         if ($courier_context) {
             if ($operation == 'delete') {
                 $courier_context->delete();
             }
         } else {
             if ($operation == 'create') {
                 $entity_type_info = \Drupal::entityManager()->getDefinition($entity_type);
                 $courier_context = CourierContext::create(['label' => t('Event (@entity_type): Registration', ['@entity_type' => $entity_type_info->getLabel()]), 'id' => 'rng_registration_' . $entity_type, 'tokens' => [$entity_type, 'registration']]);
                 $courier_context->save();
             }
         }
     }
 }