function webform_node_requirements in Webform 8.5
Same name and namespace in other branches
- 6.x modules/webform_node/webform_node.install \webform_node_requirements()
Implements hook_requirements().
1 call to webform_node_requirements()
- WebformNodeUninstallTest::testWebformNodeUninstall in modules/
webform_node/ tests/ src/ Kernel/ WebformNodeUninstallTest.php - Tests the webform_node_uninstall() method.
File
- modules/
webform_node/ webform_node.install, line 11 - Install, update and uninstall functions for the webform node module.
Code
function webform_node_requirements($phase) {
$requirements = [];
// Throw error if Webform (webform) content type is already exists which will
// happen during a D7 to D8 content migration.
// @see https://www.drupal.org/node/2856599
if ($phase === 'install') {
$manager = \Drupal::entityTypeManager();
if ($manager
->hasDefinition('node_type') && ($node_type = $manager
->getStorage('node_type')
->load('webform'))) {
$requirements['webform_node'] = [
'title' => t('Webform Node'),
'value' => t('%title content type already exists', [
'%title' => $node_type
->label(),
]),
'description' => t('%title content type already exists, please delete the %title content type before installing the Webform node module.', [
'%title' => $node_type
->label(),
]),
'severity' => REQUIREMENT_ERROR,
];
}
}
return $requirements;
}