paragraphs_ee_sets.install in Paragraphs Editor Enhancements 8
Installation hooks for paragraphs_ee_sets module.
File
modules/paragraphs_ee_sets/paragraphs_ee_sets.installView source
<?php
/**
* @file
* Installation hooks for paragraphs_ee_sets module.
*/
/**
* Implements hook_install().
*/
function paragraphs_ee_sets_install() {
// Assign a weight higher than paragraphs_ee and paragraphs_sets.
module_set_weight('paragraphs_ee_sets', 20);
}
/**
* Implements hook_requirements().
*/
function paragraphs_ee_sets_requirements($phase) {
$requirements = [];
if (!in_array($phase, [
'install',
'runtime',
])) {
return $requirements;
}
// Check version of paragraphs module.
$module_info = \Drupal::service('extension.list.module')
->getExtensionInfo('paragraphs_sets');
if (empty($module_info['version'])) {
// Module checked out from git so we assume it is newer than required.
return $requirements;
}
if (version_compare($module_info['version'], '8.x-2.1', '<')) {
$requirements['paragraphs'] = [
'title' => t('Paragraphs version'),
'description' => t('You need to install at least version 8.x-2.1 of the %paragraphs_sets module (installed version is %version).', [
'%paragraphs' => 'Paragraphs Sets',
'%version' => $module_info['version'],
]),
'value' => t('Incompatible version'),
'severity' => REQUIREMENT_ERROR,
];
}
return $requirements;
}
Functions
Name | Description |
---|---|
paragraphs_ee_sets_install | Implements hook_install(). |
paragraphs_ee_sets_requirements | Implements hook_requirements(). |