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) »
  • Support »
  • Using CiviCRM »
  • Using Drupal Modules (Moderator: Donald Lobo) »
  • using view with civicrm actions
Pages: [1]

Author Topic: using view with civicrm actions  (Read 3029 times)

jamie

  • I post occasionally
  • **
  • Posts: 95
  • Karma: 6
using view with civicrm actions
January 17, 2012, 10:43:22 am
At PTP we're evaluating the use of CiviCRM's search builder vs. Drupal views. It seems like a lot of energy is being put into Views integration and there is a lot more flexibility in views for building complex searches.

However, I don't think we can't apply CiviCRM Actions to the results of views like we can to the results of any CiviCRM search.

Has anyone explored adding this feature? Or are there any other known work-arounds?

I have some experience with Views Bulk Operations, which might provide a helpful framework for combinng the results of a Drupal views query with CiviCRM actions.

Any other suggestions would be welcome.

Thanks!

jamie


petednz

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4899
  • Karma: 193
    • Fuzion
  • CiviCRM version: 3.x - 4.x
  • CMS version: Drupal 6 and 7
Re: using view with civicrm actions
January 17, 2012, 11:15:06 am
Hi Jamie - i would agree with you on this. The other option I have used, not for civicrm data, in D6, is the editable fields module.
Between that and VBO we would have great ability to do quick data updates.
But it doesn't give us access to many of the other 'actions' - perhaps some API guru can jump in with a 'wow it would be so easy to build an API based option to work from Views data' ;-)
Sign up to StackExchange and get free expert advice: https://civicrm.org/blogs/colemanw/get-exclusive-access-free-expert-help

pete davis : www.fuzion.co.nz : connect + campaign + communicate

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: using view with civicrm actions
January 17, 2012, 11:33:39 am
It would be absolutely magic if we could get the mass action generic enough so it can be called from anywhere, not only from a search result.

I did try re-using the existing form, but qF and the magic hidden params stopped me. It would be great if there is a new menu civicrm/contact/actions that can take an action ("mail","pdf","add_group"...) and either a group id or an array of ids

X+
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: using view with civicrm actions
January 17, 2012, 05:02:00 pm

check:

http://dharmatech.org/ideas/2012/vbo-actions-civicrm-custom-fields

views has got a lot of work/power behind it and is the better alternative, IMO :)

Making the set of actions / tasks generic and can be called from other places (with a set of contact ids) is a good thing. I dont think it should be too hard. A good sprint topic

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

mostou

  • I’m new here
  • *
  • Posts: 14
  • Karma: 0
  • CiviCRM version: 4.1.3
  • CMS version: Drupal 7.14
  • MySQL version: 5
  • PHP version: 5
Re: using view with civicrm actions
May 22, 2013, 01:33:02 pm
I am looking into Views and VBO as well for Civicrm contacts - I think it is a very intesting combo.

dharmatech.org is not online anymore, but I found a cached version of the link here:
http://web.archive.org/web/20120823132651/http://dharmatech.org/ideas/2012/vbo-actions-civicrm-custom-fields

Definately interesting. However hook_node_operations() is not supported by VBO for D7 as far as I understood - but I may have misunderstood something. So for Drupal 7 you should only use hook_action_info(). I have tried with the following code in a custom module. The action is listed in the action list (/admin/config/system/actions) but no vbo field is available in my civicrm contact view. Has anyone succeeded with the vbo integration for Civicrm contacts in Drupal 7?

Code: [Select]
function civicrm_vbo_action_info() {
return array(
'civicrm_vbo_action' => array(
'label' => t('civicrm custom api action'),
'type' => 'civicrm_contact',
'configurable' => FALSE,
'triggers' => array('any'),
),
);
}

function civicrm_vbo_action($object, $context = array()) {
dpm($object);
dpm($context);
return 'test';
}

petednz

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4899
  • Karma: 193
    • Fuzion
  • CiviCRM version: 3.x - 4.x
  • CMS version: Drupal 6 and 7
Re: using view with civicrm actions
May 22, 2013, 01:53:42 pm
No not tried - but both VBO and Editable Fields http://drupal.org/project/editablefields  have looked like they would make interesting partners if the changes could be pushed in via the API
Sign up to StackExchange and get free expert advice: https://civicrm.org/blogs/colemanw/get-exclusive-access-free-expert-help

pete davis : www.fuzion.co.nz : connect + campaign + communicate

mostou

  • I’m new here
  • *
  • Posts: 14
  • Karma: 0
  • CiviCRM version: 4.1.3
  • CMS version: Drupal 7.14
  • MySQL version: 5
  • PHP version: 5
Re: using view with civicrm actions
May 24, 2013, 01:15:48 am
I have now asked in the vbo issue queue to be sure (http://drupal.org/node/2001364). hook_views_bulk_operations_object_info is no longer supported by VBO since VBO is now completely based on Drupal entities - hook_action_info or a Rules component should do the trick. But since CiviCRM contacts are non-drupal-entities my sample code will not work. And because vbo is completely based on Drupal entities in D7, the example from Dharmatech will not work either.

A previous feature request for handling non-drupal-entities in vbo was raised in this issue http://drupal.org/node/1985622. But Bojanz rejects the feature request - it actually makes good sense. He mentions that it is possible to implement hook_entity_info() for a datastructure - this will give alot of other benefits in terms of other Drupal modules based on Drupal entities. http://drupal.org/node/1985622#comment-7372052

I am not yet familar with editablefields in Drupal, but it seems interesting. I have also found the Spark project that will be included in Drupal 8 core. In this Spark issue (http://drupal.org/node/1865600) inplace editing of views is mentioned - it is supported via the Edit module - the Edit module is based on Drupal entities as well and will be included in Drupal 8 core as a part of Spark. It seems there is still work to be done for the Spark project and Edit module. But if it is possible to implement entity_info for CiviCRM contact datastructure it may open up alot of other interesting possibilities in the future for using other Drupal modules together with CiviCRM.

Will it be possible to implement hook_entity_info for CiviCRM contacts? Does it make any sense? Has there been any talk about this?

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: using view with civicrm actions
May 24, 2013, 06:56:47 am

yes, lots of talk on it. Would be great for someone to spearhead this effort. Some details here:

http://forum.civicrm.org/index.php/topic,27871.msg121412.html#msg121412

Any chance you can spend time on making this happen?

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

mostou

  • I’m new here
  • *
  • Posts: 14
  • Karma: 0
  • CiviCRM version: 4.1.3
  • CMS version: Drupal 7.14
  • MySQL version: 5
  • PHP version: 5
Re: using view with civicrm actions
May 24, 2013, 11:27:51 pm
Thanks alot for the info Lobo. I have done some more reading via your link.

And a quick test of the civicrm_entity module by Eileen was actually quite promising. I succeeded in creating a vbo-field in my CiviCRM view with actions either from a custom module (hook_actions_info) or via a rules component. As long as the contact_id is passed to the action it will be possible via the API to create lots of custom actions.

Definately the way to go for future Drupal integration projects since it will open up alot of possibilities of using other Drupal modules in connection with CiviCRM.

petednz

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4899
  • Karma: 193
    • Fuzion
  • CiviCRM version: 3.x - 4.x
  • CMS version: Drupal 6 and 7
Re: using view with civicrm actions
May 25, 2013, 12:46:02 am
Nice timing ;-) We were about to take a poke at this next week but this could save Eileen some time on the first steps. Care to share what you have put together so far?
Sign up to StackExchange and get free expert advice: https://civicrm.org/blogs/colemanw/get-exclusive-access-free-expert-help

pete davis : www.fuzion.co.nz : connect + campaign + communicate

mostou

  • I’m new here
  • *
  • Posts: 14
  • Karma: 0
  • CiviCRM version: 4.1.3
  • CMS version: Drupal 7.14
  • MySQL version: 5
  • PHP version: 5
Re: using view with civicrm actions
May 25, 2013, 02:07:38 am
Basically I used Eileens github module (it seems it is the same as in her Drupal sandbox - the recent commit in github is however not transferred yet to the Drupal sandbox).

It worked straight out of the box. I am using vbo together with Rules Components PHP actions - then I can create various custom Civi actions via the api. For instance update of existing membership:
Code: [Select]
civicrm_initialize();

$params = array(
  'version' => 3,
  'id' => [civi-contact:id],
  'membership_end_date' => '2013-12-31',
);

$result = civicrm_api('Membership', 'update', $params);

I have also made a post in this thread Lobo is referring to:
http://forum.civicrm.org/index.php?topic=27871.msg123786#msg123786

I am a bit unsure in which thread to continue the discussion about this. Sonicthoughts has made a great overview here:
http://forum.civicrm.org/index.php?topic=27871.msg121412#msg121412

And here:
http://wiki.civicrm.org/confluence/display/CRM/Make+it+happen+candidates

I am not a developer myself, more a web project manager and system manager. I know how to edit basic php and write some basic Civi API functions, but I am definately not a hardcore developer. It's not my professional job either - just volunteering in some non-profit organizations so funding from my site will unfortunately also be very limited. But I am willing to help in testing the module for different use-case scenarios and report back the errors.

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Drupal Modules (Moderator: Donald Lobo) »
  • using view with civicrm actions

This forum was archived on 2017-11-26.