mjordan / islandora_repository_reports

A Drupal 8 module that provides a collection of graphical reports on various aspects of an Islandora repository.
GNU General Public License v2.0
2 stars 5 forks source link

If data source plugin has been uninstalled, don't WSOD #22

Closed mjordan closed 4 years ago

mjordan commented 4 years ago

This shouldn't happen often in the wild, but if a user has just used a report, and then the module that provides the report is uninstalled, the user gets a WSOD the next time they visit the reports page. We should check for the service that provides the report's data. This cod should do it:

if (!empty(\Drupal::hasService('serviceID'))) {
  $foo = \Drupal::service('serviceID');
}
else {
  // Tell user the report they requested is not available.
}