X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=web%2Fmodules%2Fcontrib%2Fcrop%2Fcrop.install;h=e9b055bd5dd02d2f024e28da5b706eb7542dfec2;hp=4394e44095406d60c726beac7ba842e71b82cc3e;hb=9e65bae52407293a5182f19dc57b5628b09e92f4;hpb=af6d1fb995500ae68849458ee10d66abbdcfb252 diff --git a/web/modules/contrib/crop/crop.install b/web/modules/contrib/crop/crop.install index 4394e4409..e9b055bd5 100644 --- a/web/modules/contrib/crop/crop.install +++ b/web/modules/contrib/crop/crop.install @@ -7,6 +7,38 @@ use Drupal\crop\Entity\Crop; +/** + * Implements hook_requirements(). + */ +function crop_requirements($phase) { + $requirements = []; + + // This branch of Crop API shouldn't be used with core < 8.4.x or with + // media_entity 1.x enabled. + $incompatible = FALSE; + $drupal_version = explode('.', \Drupal::VERSION); + if ($drupal_version[1] < 4) { + $incompatible = TRUE; + } + elseif (\Drupal::moduleHandler()->moduleExists('media_entity')) { + $info = system_get_info('module', 'media_entity'); + if (version_compare($info['version'], '8.x-2') < 0) { + $incompatible = TRUE; + } + } + + if ($incompatible) { + $requirements['crop_media'] = [ + 'title' => t('Crop API'), + 'value' => t('This branch of Crop API is not compatible with the version of Media Entity installed.'), + 'description' => t('This branch of Crop API is not compatible with the version of Media Entity installed.'), + 'severity' => REQUIREMENT_ERROR, + ]; + } + + return $requirements; +} + /** * Delete orphaned crop entities. */ @@ -59,12 +91,3 @@ function crop_update_8002() { \Drupal::service('config.installer') ->installDefaultConfig('module', 'crop'); } - -/** - * Uninstall deprecated sub-module from active instance. - */ -function crop_update_8003() { - if (\Drupal::moduleHandler()->moduleExists('crop_media_entity')) { - \Drupal::service('module_installer')->uninstall(['crop_media_entity']); - } -}