I want to know how to add conflicts in D8 info.yml.
I tried like this in D8 .info.yml:
name: Example
type: module
description: some example.
core: 8.x
package: Other
dependencies:
- menu_ui
conflicts:
- module1
- module2
and in .install file
<?php
/**
* Implements hook_requirements().
*/
function example_requirements($phase) {
$requirements = [];
switch ($phase) {
// Called while the module is installed.
case 'install':
if (\Drupal::moduleHandler()->moduleExists('module1')) {
$requirements[] = [
'title' => t('Module 1'),
'value' => t('Module 1'),
'description' => t('Module 1 conflicts with example.'),
'severity' => REQUIREMENT_ERROR,
];
}
break;
}
return $requirements;
}
But in D7 it is working:
name = Example
description = some example.
core = 7.x
dependencies[] = menu
package = Other
conflicts[] = module1
conflicts[] = module2
While enabling my example module it is not showing any conflict error in D8.
Installation Order:
1) Fresh Drupal installation.
2) Module 1
3) Module 2
4) Example module(here i need to show module1 and 2 are present while installing)