hook->on('template:layout:css', array( 'template' => 'plugins/FinanceBuddy/Asset/css/finance.css', )); // Per-board opt-in: a checkbox on the project's Settings -> Integrations page. Nothing // else in the plugin renders or saves until a project manager enables it for that board. $this->template->hook->attach('template:project:integrations', 'financeBuddy:project/integration'); // Finance fields in the task create/edit form (middle column). The template gates itself // on the board being enabled. These are not task columns, so core cannot persist them: // FinancePersistence strips them from the task write and stores them in task metadata, // all synchronously via the model hooks below. $this->template->hook->attach('template:task:form:second-column', 'financeBuddy:task/form_fields'); $persistence = new \Kanboard\Plugin\FinanceBuddy\Model\FinancePersistence($this->container); $this->hook->on('model:task:creation:prepare', array($persistence, 'onCreationPrepare')); $this->hook->on('model:task:creation:aftersave', array($persistence, 'onCreationAfterSave')); $this->hook->on('model:task:modification:prepare', array($persistence, 'onModificationPrepare')); // Carry the finance metadata onto copies (which Kanboard does not copy): native recurrence // advances the installment for the next occurrence (creation:aftersave via recurrence_parent), // and a manual Duplicate copies it verbatim. $this->hook->on('model:task:duplication:aftersave', array($persistence, 'onDuplication')); // RecoReco (calendar recurrence) spawns a copy and emits this signal. The clone already got // the finance verbatim (via onDuplication above); here we advance the SOURCE template's // installment, since RecoReco's ongoing card is the template that stays. $this->hook->on('recoreco:task:spawned', array($persistence, 'onRecoRecoSpawn')); // The line-3 money badge on each board card, rendered directly under the title. Two hooks: // "private" is the normal board, "public" is the read-only board shared by token. $this->template->hook->attach('template:board:private:task:after-title', 'financeBuddy:board/task_money'); $this->template->hook->attach('template:board:public:task:after-title', 'financeBuddy:board/task_money'); // Per-column net total (credits - debits) in the column header. $this->template->hook->attach('template:board:column:header', 'financeBuddy:board/column_total'); // "Hide/Show column total" toggle in the column dropdown menu. The only column-menu hook // renders after the native