Spacialist
Spacialist copied to clipboard
[0.12] Allow plugins to register attribute types
This PR adds the logic for plugins to add attribute types. The required steps to see these custom attributes are:
- Add
<attributes>section toinfo.xmlwith all<attribute>'s pointing to attribute definition class usingsrcproperty (relative tolibfolder)
<attributes>
<attribute src="App\AttributeTypes\CustomAttribute.php" />
</attributes>
The attribute definition class must extend the abstract AttributeBase from the core repo and set at least $type (attribute datatype, same as in SpPS.registerComponent() and $label (used for i18n; refering to path in i18n .json files)
2. Register the plugin (SpPS.register({...}))
3. Register component using the new SpPS.registerComponent({...}) method
SpPS.registerComponent({
of: PLUGIN-ID',
type: 'attribute',
key: DATATYPE,
datatype: DATATYPE,
component: IMPORTED-Vue-File,
});