Spacialist icon indicating copy to clipboard operation
Spacialist copied to clipboard

[0.12] Allow plugins to register attribute types

Open v1r0x opened this issue 11 months ago • 0 comments

This PR adds the logic for plugins to add attribute types. The required steps to see these custom attributes are:

  1. Add <attributes> section to info.xml with all <attribute>'s pointing to attribute definition class using src property (relative to lib folder)
<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,
});

v1r0x avatar May 07 '25 09:05 v1r0x