You are here

function _siteimprove_entity_save in Siteimprove 8

Entity save common method.

Parameters

\Drupal\Core\Entity\EntityInterface $entity: Entity being saved.

2 calls to _siteimprove_entity_save()
siteimprove_entity_insert in ./siteimprove.module
Implements hook_entity_insert().
siteimprove_entity_update in ./siteimprove.module
Implements hook_entity_update().

File

./siteimprove.module, line 208
Drupal module: Siteimprove Plugin.

Code

function _siteimprove_entity_save(EntityInterface $entity) {
  if (Drupal::currentUser()
    ->hasPermission('use siteimprove')) {
    switch ($entity
      ->getEntityTypeId()) {
      case 'node':
        if (!empty($entity
          ->get('status')->value)) {
          \Drupal::service('siteimprove.utils')
            ->setSessionUrl($entity);
        }
        break;
      case 'taxonomy_term':
        \Drupal::service('siteimprove.utils')
          ->setSessionUrl($entity);
        break;
    }
  }
}