This question is about Rules on Drupal 8.
Reading the documentation, I find information about how to replace many of the hooks, but not hook_rules_data_info. It might be obvious, but please point me in the right direction and consider adding this info to the docs.
In Drupal 7 I just had:
'property info' => array( 'uid' => array( 'type' => 'integer', 'label' => t('User ID'), ), 'timestamp' => array( 'type' => 'integer', 'label' => t('Timestamp'), ), 'name' => array( 'type' => 'text', 'label' => t('Name'), ) );
How do you properly define the samething? As a subclass of
This is basically a repost of the issue "hook_rules_data_info replacement" in the hope that someone here has worked enough with Rules on Drupal 8 to easily solve this. In that issue Fago wrote this (in comment # 3 of it):
... that's now covered by the Typed Data API. Thus, you'd define a new data type using typed data. You can then use it in Rules. For structures like that, you'd need to define a complex data type, i.e. you can extend from the Map base class in the ComplexDataDefinition base class. The definition class needs to be used for defining the structure, for the actual instance class you can use whatever fits your use case. Could be that Map is already perfectly fine for your use case.
To which I replied:
I'm happy that I wasn't complete off the track, but I still think the Rules documentation would benefit from a code sample. I did try to look at Typed Data API documentation, but I didn't really find the help I needed. I'll look at that Map class again ...
So basically, I maintain my question. Alternative title: "How to use the Typed Data API with Rules"