Skip to content
Snippets Groups Projects
Commit f77c38b4 authored by Pierre Dureau's avatar Pierre Dureau
Browse files

WIP SourcePluginManager

parent fef64b8a
No related branches found
No related tags found
No related merge requests found
...@@ -43,12 +43,28 @@ class SourcePluginManager extends DefaultPluginManager implements ContextAwarePl ...@@ -43,12 +43,28 @@ class SourcePluginManager extends DefaultPluginManager implements ContextAwarePl
*/ */
public function getDefinitionsForPropType(string $prop_type_id, array $contexts = []): array { public function getDefinitionsForPropType(string $prop_type_id, array $contexts = []): array {
$definitions = $this->getDefinitionsForContexts($contexts); $definitions = $this->getDefinitionsForContexts($contexts);
// $yo = $this->
$definitions = array_filter($definitions, function ($definition) use ($prop_type_id) { $definitions = array_filter($definitions, function ($definition) use ($prop_type_id) {
return in_array($prop_type_id, $definition['prop_types']); return in_array($prop_type_id, $definition['prop_types']);
}); });
return $definitions; return $definitions;
} }
/**
* ...
*/
protected function getConvertibleDefinitions(string $prop_type_id, array $contexts = []): array {
$definitions = [];
$prop_type_definition = $this->prop_type_manager->getDefinition($prop_type_id);
if (!isset($prop_type_definition['convert_from'])) {
return [];
}
foreach ($prop_type_definition['convert_from'] as $convertible_prop_type_id) {
$definitions[$convertible_prop_type_id]) = $this->getDefinitionsForPropType($convertible_prop_type_id, $contexts);
}
return $definitions;
}
/** /**
* Returns the default source identifier for a prop type. * Returns the default source identifier for a prop type.
*/ */
... ...
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment