VBO provides some nice integration with Rules, such as the action "Load a list of entities from a VBO View" and the condition "Check number of results returned by a VBO View".

I suggest that these Rules plugins are separated into a new sub module of VBO, and extended with two more plugins:

* A View data type for Rules, describing properties such as view name, display, arguments/contextual filter values, and probably also fields. These should come with sensible UI to set the values, where applicable.
* An event A view is rendered.

Why a new sub module? Well, I think most people use VBO to get nice administration pages, and not for creating super-cool but complex Rules-Views functionality. Adding the two plugins above definately makes sense to me, but they would kind of bloat VBO "core". But adding the actions to another, separate module would just be crazy – VBO is the perfect bridge between Views and Rules.

I'd be happy to try to write the first plugin – I have not yet written any data type plugins and need/want to learn this. The code for the second plugin is already written (but would have to be rewritten to make use of the first plugin). Both could be written as a part of Rules Bonus Pack, and then transfered to VBO when they are stable.

How does this sound?

Edit: This issue is somewhat related to [#4842806].

Comments

bojanz’s picture

I agree with this idea. Feel free to start work :)

What should the submodule be named? views_bulk_operations_rules_extras?

itangalo’s picture

Sweet! I'll continue to read about data types for Rules, and will eventually start coding.

I vote for a short name for the sub module – vbo_rules_views or something.

Cheers!

bojanz’s picture

Our namespace is views_bulk_operations, I can't really shorten it. And I don't want to give users the impression that they need to enable that module in order to use Rules with VBO. I think I'll go with "views_bulk_operations_rules_extras".

itangalo’s picture

Right! I'm getting prepared to use copy-paste when creating function names. :-)

aristeides’s picture

subscribing

itangalo’s picture

Assigned: Unassigned » itangalo

Work is now in progress! I'm doing the experimenting over at Rules Bonus Pack, which now has a "Views" sub module.

It provides a data type "view_display" that has properties for view machine name, human-readable name, current display name, base table, number of results, and arguments. Currently it only supports reading data, not writing, which is kind of a bummer. Working on it.

It also has an event "view is going to be rendered".

itangalo’s picture

For information: I'm making progress, but I will probably start over soon. Right now I'm passing around the actual view object, which probably leads to quite a bit of memory consumption. Eventually I will change this to an object just representing the view object. But not now. :-)

itangalo’s picture

Ok, there is now some pretty stable functionality for this!

It absolutely needs testing and reviewing and stuff – I know one or two things that might cause problems – but it can now be tried and used. There's a screencast available at http://nodeone.se/blogg/rules-bonus-pack-views summarizing some of the stuff.

bojanz’s picture

Status: Active » Postponed

Let's have this grow in Rules Bonus Pack for now. That way you can iterate fast without having to go through me, and we can see how it evolves.
Your list of potential use cases makes sense, though having to know which action to respond to is problematic.
Right now I'm just not convinced enough that this needs to be in VBO, and not Bonus Pack, or any other module.

itangalo’s picture

Good thinking. The more I experiment with Rules + Views, the more certain I am that we'll see much more integration and that we can't yet know which is useful (and what approaches are good/bad). I'll be cultivating the ideas in the Rules Bonus Pack greenhouse.

Are you interested in me posting summaries about the progress here?

bojanz’s picture

Definitely! Very interested to see how this evolves.

itangalo’s picture

Retroactive update: There is now some experimental support for using Rules components for validating – and changing – Views arguments.

Screencast demo: http://vimeo.com/31904083
Summary of how it should be updated: #1338790: New plugin for Views argument validators

bojanz’s picture

Status: Postponed » Closed (won't fix)

At this point it seems that the Bonus Pack is a better home for this code.

bojanz’s picture

Issue summary: View changes

Added a link to issue #4842806, "Provide a rules action that allows loading all entities from a view into Rules".