CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • how to create a component which adds a contact search task
Pages: [1]

Author Topic: how to create a component which adds a contact search task  (Read 1461 times)

mfb

  • Guest
how to create a component which adds a contact search task
October 21, 2008, 03:27:01 pm
I see there is a function CRM_Core_Component::taskList( ) which looks like it can return a list of tasks to be added to the array of contact search tasks. However, I'm not clear how to make my component actually add a task here?

Yashodha Chaku

  • Forum Godess / God
  • Ask me questions
  • *****
  • Posts: 755
  • Karma: 57
    • CiviCRM
Re: how to create a component which adds a contact search task
October 21, 2008, 03:48:26 pm
If you want to add a new task for a component (say CiviEvent), the place to do it is CRM/Event/Task.php

hth
-Yashodha
Found this reply helpful? Contribute NOW and help us improve CiviCRM with the Make it Happen! initiative.

mfb

  • Guest
Re: how to create a component which adds a contact search task
October 21, 2008, 03:50:06 pm
I'll look at creating a Task.php file. Note, I am talking about my own add-on component, with which I am trying to inject some additional tasks into CiviCRM Core, not modifying an existing component.

mfb

  • Guest
Re: how to create a component which adds a contact search task
October 21, 2008, 04:49:15 pm
It looks to me like a problem in CRM/Core/Component.php: $info[$name] is an object not an array, so CRM_Utils_Array::value('task', $info[$name]) never returns anything. I was able to change it according to the following patch, and add a task to my component's info array.  Is this how it was intended to work?

Code: [Select]
Index: CRM/Core/Component.php
===================================================================
--- CRM/Core/Component.php (revision 17604)
+++ CRM/Core/Component.php (working copy)
@@ -320,8 +320,8 @@
         
         $tasks = array( );
         foreach( $info as $name => $value ) {
-            if( CRM_Utils_Array::value( 'task', $info[$name] ) ) {
-                $tasks += $info[$name]['task'];
+            if( CRM_Utils_Array::value( 'task', $info[$name]->info ) ) {
+                $tasks += $info[$name]->info['task'];
             }
         }
         return $tasks;

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • how to create a component which adds a contact search task

This forum was archived on 2017-11-26.