- Merge request !145Resolve #3547579 "Hook storage prop shape alter allow specifying when to reevaluate" β (Merged) created by wim leers
- Assigned to penyaskito
- Status changed to Needs work
about 2 months ago 11:04am 28 November 2025
Identified at https://git.drupalcode.org/project/canvas/-/merge_requests/23#note_590788 on π Calculating dependencies not including the intermediate dependencies Active .
hook_storage_prop_shape_alter() is basically the only PHP API that Canvas offers.
However, the results of this method may need to be re-evaluated based on external changes that Canvas is unaware of.
\Drupal\canvas\Hook\ShapeMatchingHooks::mediaLibraryStoragePropShapeAlter() implements this hook on behalf of the media_library module.
Component config entities are updated automatically with the field type+widget that should be used for "image"-shaped props. If there are >=1 MediaTypes using the image MediaSource plugin. If there's zero, Canvas sticks to its default that is guaranteed to work (the image field type+widget).
MediaTypes the first time it ran, and then the user creates their first such MediaType, then the site incorrectly stays "stuck" on using the image field type, rather than switching to the media library widget!
hook_storage_prop_shape_alter() to convey what cache tags cause its results/conclusions to change. In the case of ShapeMatchingHooks::mediaLibraryStoragePropShapeAlter() that's the config:media_type_list cache tag.
Allow hook_storage_prop_shape_alter() to receive cache tags from the hook implementations that should cause it to be called again if those cache tags are invalidated.
See the example above: the π would disappear.
Active
1.0
Shape matching
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.