Problem/Motivation
image_widget_crop_requirements() implements a renderable array to display errors:
if (!empty($error)) {
$requirements['iwc_libraries']['severity'] = REQUIREMENT_ERROR;
$requirements['iwc_libraries']['description'][] = [
'#theme' => 'item_list',
'#items' => $error,
];
}
However, renderable arrays are only supported during runtime:
hook_requirements()messages currently work with render arrays for runtime requirements messages. However, the documentation does not explicitly state that render arrays are allowed. Additionally, install phase requirements do not support render arrays because indrupal_check_module()they are passed todrupal_set_message(), and also to a placeholder in at()following #2501639: Remove SafeMarkup::set in drupal_check_module().
#2505499: Explicitly support render arrays in hook_requirements()
Proposed resolution
Only return a renderable array in hook_requirements during the 'runtime' phase.
Remaining tasks
- Write a patch
- Review
- Commit
User interface changes
None.
API changes
None.
Data model changes
None.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | image_widget_crop-requirements_renderable_array-2988156-2.patch | 4.35 KB | idebr |
Comments
Comment #2
idebr commentedAttached patch implements a conditional on $phase === 'runtime', so
image_widget_crop_requirements()only returns a renderable array in hook_requirements during the 'runtime' phase.Comment #3
woprrr commentedYou totally right ! RTBC to me !
Thank a lot for this contribution !! I hope see you again in other issue if this module help you he need you too :)
Comment #5
woprrr commented