function image_requirements
Same name in other branches
- 7.x modules/image/image.install \image_requirements()
- 9 core/modules/image/image.install \image_requirements()
- 8.9.x core/modules/image/image.install \image_requirements()
- 11.x core/modules/image/image.install \image_requirements()
Implements hook_requirements().
File
-
core/
modules/ image/ image.install, line 38
Code
function image_requirements($phase) {
if ($phase != 'runtime') {
return [];
}
$toolkit = \Drupal::service('image.toolkit.manager')->getDefaultToolkit();
if ($toolkit) {
$plugin_definition = $toolkit->getPluginDefinition();
$requirements = [
'image.toolkit' => [
'title' => t('Image toolkit'),
'value' => $toolkit->getPluginId(),
'description' => $plugin_definition['title'],
],
];
foreach ($toolkit->getRequirements() as $key => $requirement) {
$namespaced_key = 'image.toolkit.' . $toolkit->getPluginId() . '.' . $key;
$requirements[$namespaced_key] = $requirement;
}
}
else {
$requirements = [
'image.toolkit' => [
'title' => t('Image toolkit'),
'value' => t('None'),
'description' => t("No image toolkit is configured on the site. Check PHP installed extensions or add a contributed toolkit that doesn't require a PHP extension. Make sure that at least one valid image toolkit is installed."),
'severity' => REQUIREMENT_ERROR,
],
];
}
return $requirements;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.