function uc_product_uc_store_status in Ubercart 8.4
Same name and namespace in other branches
- 7.3 uc_product/uc_product.module \uc_product_uc_store_status()
Implements hook_uc_store_status().
Displays the status of the product image handlers.
See also
uc_product_image_defaults()
File
- uc_product/
uc_product.module, line 589 - The product module for Ubercart.
Code
function uc_product_uc_store_status() {
$instances = \Drupal::service('entity_field.manager')
->getFieldDefinitions('node', 'product');
$field = NodeType::load('product')
->getThirdPartySetting('uc_product', 'image_field', 'uc_product_image');
if (isset($instances[$field])) {
$status = 'ok';
$description = t('Product image support has been automatically configured by Ubercart.');
}
else {
$status = 'warning';
$description = t('<a href=":url">Click here</a> to automatically configure core image support.', [
':url' => Url::fromRoute('uc_product.image_defaults')
->toString(),
]) . ' ' . t('(This action is not required and should not be taken if you do not need images or have implemented your own image support.)');
}
return [
[
'status' => $status,
'title' => t('Images'),
'desc' => $description,
],
];
}