2

I know that I can get the default description of a Task with:

$this->description;
//or
$this->getDescription();

But how can I get the description if it got changed on creation:

craft()->tasks->createTask('Mailer', $new_description);

Adding it as an attribute doesn't seem "right" to me:

craft()->tasks->createTask('Mailer', $new_description, array('description' => $new_description));
3

The description you define in getDescription() is just the default description in the event that no description was specified when craft()->tasks->createTask() was called.

The actual description for the task is saved on the TaskModel, which you can get via $this->model from your Task class:

$description = $this->model->description;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.