What is the best way to globally add data to the "site:" state?

Events happening in the community are now at Drupal community events on www.drupal.org.
jaxxed's picture

DRP7, Rules 7.x-2.2

I'm working on a concept for keeping lists of taxonomy terms to have a 'related-entities' concept, in a custom module. E.g. Showing a node? here are the tids for the 'category' vocab, now I can create a block that show nodes with the matching tids.

I have a context implementation working well, but thought to add a Rules based implementation as well.

I started with a custom rules reaction - which is good, but then discovered the rules list data type, which meets the needs. What I would need then is to define a list that can de selected in the UI "Data Selector" (or backend equiv.)
I can use an reaction to create that list, but is there a way to use one of the hook_rules_* to automatically create the item in the state?

In my searching I've noticed that when a state object is created it starts off with the 'site' parent, but I can't find where things like 'site:current-user' are created?

How do you globally modify the state in this manner?

I can see the RulesPlugin->setUpState method, and the RulesPlugin::availableVariables , but I'm not seeing anything other than perhaps using the very global hook_rules_config_execute

Any Opinions?

Comments

RulesData->addSiteMetaData

jaxxed's picture

If found the public static function addSiteMetadata() method in RulesData.

The comment on this method is:

  /**
   * Property info alter callback for the entity metadata wrapper to inject
   * metadata for the 'site' variable. In contrast to doing this via
   * hook_rules_data_info() this callback makes use of the already existing
   * property info cache for site information of entity metadata.
   *
   * @see RulesPlugin::availableVariables()
   */

This seems to suggest that the hook_rules_data_info can be used to add data to the tree. Perhaps I was wrong in my understanding that one can only add 'data types' via that hook, or that what I am actually trying to do is to add a 'data type'.

J

Rules

Group organizers

Group categories

Categories

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds:

Hot content this week