- Issue created by @pdureau
- Assigned to oldeb
- Status changed to Closed: works as designed
about 1 year ago 10:04am 10 May 2024 - 🇧🇪Belgium oldeb Namur 🇧🇪
Check for correct scheme is already done in the ComponentPluginManager::annotateProps/a> method.
PropType availiblity is done by the PluginManagerBase::createInstance method.
- 🇫🇷France pdureau Paris
Check for correct scheme is already done in the ComponentPluginManager::annotateProps method.
It is not the same check .Sure, it is technically the same, but not at the same moment for the same purpose.
Anyway, the check is already done, indeed, by the stream_wrapper service manager, because of the tags from the service definition;
ui_patterns.schema_stream_wrapper: class: Drupal\ui_patterns\SchemaManager\StreamWrapper arguments: - "@plugin.manager.ui_patterns_prop_type" tags: - { name: stream_wrapper, scheme: ui-patterns }
So, instead of doing the check again, maybe a little ocmment to explain why it is not necessary
PropType availiblity is done by the PluginManagerBase::createInstance method.
What will happen if we do
ui-patterns://this_is_not_a_prop_type
?
Because we have$plugin->getSchema()
later in the stream wrapper?https://git.drupalcode.org/project/ui_patterns/-/blob/2.0.x/src/SchemaMa...
- 🇧🇪Belgium oldeb Namur 🇧🇪
When an incorrect scheme is passed : an error is thrown. This should never happen since it's checked by the ComponentPluginManager before calling file_get_contents and, like you said, the streamwrapper is always called with the correct scheme because of the tags in the service definition.
When an incorrect plugin is passed, the file_get_contents return a string with an empty array : "[]"
So there is no error, the schema is just empty.