Giter Club home page Giter Club logo

Comments (5)

creecros avatar creecros commented on July 24, 2024

you will need to be a bit more detailed. are you creating and automatic action and don't understand how to pull the data? go step by step, what are you trying to accomplish.

from metamagik.

oszem avatar oszem commented on July 24, 2024

Thanks for the quick reply!

I would like to create an automatic action where task title is generated from metadata created via MetaMagik.

Here is my code, but it doesn't work mainly, because I don't know how to refer to metadata in getEventRequiredParameters:

`<?php

namespace Kanboard\Plugin\RenameTaskbyMetadata\Action;

use Kanboard\Model\TaskModel;
use Kanboard\Model\TaskMetadataModel;
use Kanboard\Action\Base;

class TaskRenameBasedOnMetadata extends Base
{

public function getDescription()
{
    return t('TaskRenameBasedOnMetadata');
}


public function getCompatibleEvents()
{
    return array(
        TaskModel::EVENT_CREATE_UPDATE,
    );
}


public function getActionRequiredParameters()
{
    return array(
    );
}


public function getEventRequiredParameters()
{
    return array(
        'task_id',
        'metadata1',
	);
}


public function doAction(array $data)
{
	$title_test = $this->taskMetadataModel->get($data['task_id'], $data['metadata1']);
    	$values = array(
            'id' => $data['task_id'],
    	    'title' => $title_test,
    );
	

    return $this->taskModificationModel->update($values, false);
}



public function hasRequiredCondition(array $data)
{
    return true;
}

}`

from metamagik.

creecros avatar creecros commented on July 24, 2024

OK, so, I still am sluggishly following the idea.

if a certain custom field equals a certain value, then update title to certain value?

or

no matter what, change title to certain value of custom field?

I've never pulled metadata from an event, nor have I ever pondered this to even know if such an event exists. you would need to look through the events, and see if such an event exists, im doubtful. there are workarounds, but it seems such information would be static, unless this custom field contains an array, so not fully understanding your action yet. forget the code for a second. walk me through it, step by step.

from metamagik.

oszem avatar oszem commented on July 24, 2024

So the idea is that I fill out the custom fields (metadata1, 2,3), and the task's title is generated from these custom fields' value (doesn't matter what the title currently is). As it is an array I would implode( ) them.

So do you think most probably a new event needs to be programmed?

Example: "Daniel 75kg 183cm" (metadata1: name, metadata2: weight, metadata3: height)

from metamagik.

oszem avatar oszem commented on July 24, 2024

I managed to figure it out how you export the metamagik metadata fields! Thank you!

from metamagik.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.