Skip to content

Commit

Permalink
fix - site breaks during site install
Browse files Browse the repository at this point in the history
  • Loading branch information
subhojit777 committed Feb 28, 2019
1 parent e39a339 commit 40db9b4
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions repec.module
Expand Up @@ -39,7 +39,7 @@ function repec_entity_insert(EntityInterface $entity) {

/** @var \Drupal\repec\RepecInterface $repec */
$repec = \Drupal::service('repec');
if ($repec->isEntityShareable($entity)) {
if ($repec->isBundleEnabled($entity) && $repec->isEntityShareable($entity)) {
$repec->createEntityTemplate($entity, Repec::SERIES_WORKING_PAPER);
}
}
Expand All @@ -54,7 +54,7 @@ function repec_entity_update(EntityInterface $entity) {

/** @var \Drupal\repec\RepecInterface $repec */
$repec = \Drupal::service('repec');
if ($repec->isEntityShareable($entity)) {
if ($repec->isBundleEnabled($entity) && $repec->isEntityShareable($entity)) {
$repec->updateEntityTemplate($entity, Repec::SERIES_WORKING_PAPER);
}
else {
Expand All @@ -72,7 +72,9 @@ function repec_entity_delete(EntityInterface $entity) {

/** @var \Drupal\repec\RepecInterface $repec */
$repec = \Drupal::service('repec');
$repec->deleteEntityTemplate($entity);
if ($repec->isBundleEnabled($entity)) {
$repec->deleteEntityTemplate($entity);
}
}

/**
Expand Down

0 comments on commit 40db9b4

Please sign in to comment.