Commit 12dca303 authored by Alexey Beloglazov's avatar Alexey Beloglazov Committed by Ev Maslovskiy
Browse files

Issue #3308195: Unable to install Anu LMS Permissions due to unmet dependencies

parent e8ee5d01
Loading
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Add redirect from "#section-X" to "#page-X" for lessons.
- Fixed bottom spacing for quiz page and mobile layout.
- Adjusted "Make available offline" button text when processed.
- Fixed the problem "Unable to install Anu LMS Permissions due to unmet dependencies". That was happening in a case when "Anu LMS Assessments" module was disabled when a user tried to enable "Anu LMS Permissions" module.

## [2.8.1]
- Fixed spacing for the lesson sidebar and lesson mobile navigation.
+27 −0
Original line number Diff line number Diff line
@@ -8,6 +8,7 @@
use Drupal\Core\Render\Element;
use Drupal\Core\Entity\Display\EntityFormDisplayInterface;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Config\FileStorage;

/**
 * Implements hook_views_data_alter().
@@ -71,3 +72,29 @@ function anu_lms_assessments_entity_form_display_alter(?EntityFormDisplayInterfa
    }
  }
}

/**
 * Implements hook_install().
 *
 * If "anu_lms_permissions" was already installed then necessary import
 * optional configs from that module. Optional configs from that module
 * contains dependencies to "node.type.module_assessment".
 */
function anu_lms_assessments_install() {
  $moduleHandler = \Drupal::service('module_handler');
  if (!$moduleHandler->moduleExists('anu_lms_permissions')) {
    return;
  }

  // It's "Organization: Group node (Quiz)".
  $config_name = 'group.content_type.group_content_type_d342280e2d680';

  $config_storage = \Drupal::service('config.storage');
  if (!$config_storage->exists($config_name)) {
    $config_path = Drupal::service('extension.path.resolver')
      ->getPath('module', 'anu_lms_permissions') . '/config/optional';

    $source = new FileStorage($config_path);
    $config_storage->write($config_name, $source->read($config_name));
  }
}
+0 −0

File moved.