commerce_xero-8.x-1.x-dev/commerce_xero.install
commerce_xero.install
<?php
/**
* @file
* Commerce Xero install file.
*/
/**
* Implements hook_requirements().
*/
function commerce_xero_requirements($phase) {
$requirements = [];
if ($phase == 'install') {
/** @var \Drupal\Core\Field\FieldTypePluginManagerInterface $fieldTypeManager */
$fieldTypeManager = \Drupal::service('plugin.manager.field.field_type');
$requirements['commerce_xero_reference'] = [
'title' => t('Xero Reference Field Type'),
'description' => t('The Xero Reference field type is available.'),
'severity' => REQUIREMENT_OK,
];
if (!$fieldTypeManager->hasDefinition('xero_reference')) {
$requirements['commerce_xero_reference']['severity'] = REQUIREMENT_ERROR;
$requirements['commerce_xero_reference']['description'] = t('The Xero Reference field type is not available. Confirm that the Xero module is installed, and try again.');
}
}
return $requirements;
}
