Skip to content

Commit

Permalink
Added the possibility to define parameter plugins outside of the orde…
Browse files Browse the repository at this point in the history
…red plugin list
  • Loading branch information
joelit committed Mar 2, 2022
1 parent da1716c commit ad6aa49
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 7 additions & 1 deletion model/VocabularyConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ public function __construct($resource, $globalPlugins=array())
{
$this->resource = $resource;
$this->globalPlugins = $globalPlugins;
$this->setParameterizedPlugins();
$this->setPropertyLabelOverrides();
$pluginArray = $this->getPluginArray();
$this->pluginRegister = new PluginRegister($pluginArray);
Expand All @@ -45,6 +44,7 @@ public function __construct($resource, $globalPlugins=array())
*/
public function getPluginArray() : array
{
$this->setParameterizedPlugins();
$pluginArray = array();
$vocabularyPlugins = $this->resource->getResource('skosmos:vocabularyPlugins');
if (!$vocabularyPlugins instanceof EasyRdf\Collection) {
Expand All @@ -62,6 +62,12 @@ public function getPluginArray() : array
}
$pluginArray = array_merge($pluginArray, $this->globalPlugins);

$paramPlugins = $this->resource->allResources('skosmos:useParamPlugin');
if ($paramPlugins) {
foreach ($paramPlugins as $plugin) {
$pluginArray[] = $plugin->getLiteral('skosmos:usePlugin')->getValue();
}
}
$plugins = $this->resource->allLiterals('skosmos:usePlugin');
if ($plugins) {
foreach ($plugins as $pluginlit) {
Expand Down
2 changes: 1 addition & 1 deletion tests/testconfig.ttl
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@
skosmos:feedbackRecipient "developer@vocabulary.org";
skosmos:groupClass skos:Collection;
skosmos:language "en";
skosmos:vocabularyPlugins ("plugin2" "Bravo" :parameterizedPlugin "plugin1");
skosmos:vocabularyPlugins ("plugin2" "Bravo" "plugin1");
skosmos:usePlugin "plugin1" ;
skosmos:usePlugin "plugin3" ;
skosmos:useParamPlugin :parameterizedPlugin ;
Expand Down

0 comments on commit ad6aa49

Please sign in to comment.