<= [[plugin:struct|Struct Plugin]] ====== Struct Plugin: Development Support ====== The Struct Plugin allows other plugin developers to hook into its functionality, adding additional features. ===== Registering new Types ===== The plugin signals the ''PLUGIN_STRUCT_TYPECLASS_INIT'' event which can be intercepted by [[devel:action_plugins|Action Plugins]]. There is no default action. The passed ''$data'' is an associative array listing the available [[plugin:struct:type|Types]] and their respective classes. It looks like this: array( 'Checkbox' => 'dokuwiki\\plugin\\struct\\types\\Checkbox', 'Date' => 'dokuwiki\\plugin\\struct\\types\\Date', 'DateTime' => 'dokuwiki\\plugin\\struct\\types\\DateTime', 'Decimal' => 'dokuwiki\\plugin\\struct\\types\\Decimal', 'Dropdown' => 'dokuwiki\\plugin\\struct\\types\\Dropdown', 'Lookup' => 'dokuwiki\\plugin\\struct\\types\\Lookup', 'Mail' => 'dokuwiki\\plugin\\struct\\types\\Mail', 'Media' => 'dokuwiki\\plugin\\struct\\types\\Media', 'Page' => 'dokuwiki\\plugin\\struct\\types\\Page', 'Tag' => 'dokuwiki\\plugin\\struct\\types\\Tag', 'Text' => 'dokuwiki\\plugin\\struct\\types\\Text', 'Url' => 'dokuwiki\\plugin\\struct\\types\\Url', 'User' => 'dokuwiki\\plugin\\struct\\types\\User', 'Wiki' => 'dokuwiki\\plugin\\struct\\types\\Wiki', ); Plugins may add their own ''Type'' => ''class'' pairs here. The class name has to be fully qualified and needs to be loadable by DokuWiki's [[devel:autoloader|Autoloader]]. The class needs to inherit from [[https://github.com/cosmocode/dokuwiki-plugin-struct/blob/master/types/AbstractBaseType.php|AbstractBaseType]] or one of its subclasses. Please refer to the existing types' source code to see how to implement your own type. Examples of plugins implementing this are: [[plugin:structstatus|structstatus Plugin]], [[plugin:structgroup|structgroup Plugin]], [[plugin:structjoin|structjoin Plugin]], [[plugin:structcombolookup|structcombolookup Plugin]] ===== Allow Additional Config Keys ===== When you write a plugin doing its own aggregation, you might want to reuse the ConfigParser class. By default this class will throw an Exception when a config key is encountered that it does not understand. You can handle the ''PLUGIN_STRUCT_CONFIGPARSER_UNKNOWNKEY'' event and prevent the default (of throwing the exception). You can add your own config to the ''config'' array in the event. array( 'config' => &$this->config, 'key' => 'the unknown config key', 'val' => 'the value for that key' ) Examples of plugins implementing this are: [[plugin:structgantt|structgantt Plugin]], [[plugin:structodt|structodt Plugin]] ===== Modify row rendering in AggregationTable ===== The ''PLUGIN_STRUCT_AGGREGATIONTABLE_RENDERRESULTROW'' event is called every time when the AggregationTable renders a row in a [[aggregation|struct table]]. You can use the ''BEFORE'' hook to change the default rendering procedure or ''AFTER'' to make some modifications to rendered row. array( 'id' => $this->id, 'mode' => $this->mode, 'renderer' => $this->renderer, 'searchConfig' => $this->searchConfig, 'data' => $this->data, 'rownum' => &$rownum, 'row' => &$row, ) Examples of plugins implementing this are: [[plugin:structrowcolor|structrowcolor Plugin]]