protected function RngEntityModel::deleteRngRuleComponent in RNG - Events and Registrations 3.x
Same name and namespace in other branches
- 8.2 src/RngEntityModel.php \Drupal\rng\RngEntityModel::deleteRngRuleComponent()
- 8 src/RngEntityModel.php \Drupal\rng\RngEntityModel::deleteRngRuleComponent()
Delete related entities when a rule component entity is deleted.
Parameters
\Drupal\rng\Entity\RuleComponentInterface $entity: An RNG rule component entity.
1 call to RngEntityModel::deleteRngRuleComponent()
- RngEntityModel::hook_entity_predelete in src/RngEntityModel.php 
- React to Drupal `hook_entity_predelete` hook.
File
- src/RngEntityModel.php, line 225 
Class
- RngEntityModel
- Enforces RNG model relationships.
Namespace
Drupal\rngCode
protected function deleteRngRuleComponent(RuleComponentInterface $entity) {
  // Delete a TemplateCollection if the entity is a component with
  // configuration for 'rng_courier_message'.
  if ('rng_courier_message' == $entity
    ->getPluginId()) {
    $action = $entity
      ->createInstance();
    if ($action instanceof CourierTemplateCollection) {
      $template_collection = $action
        ->getTemplateCollection();
      if ($template_collection) {
        $template_collection
          ->delete();
      }
    }
  }
}