Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Reading the documentation, I don't find any information about how replace hook_rules_data_info. It might be obvious, but please point me in the right direction and consider adding this info to the docs. I'm not skilled enough myself to update the docs.
Comments
Comment #2
hansfn CreditAttribution: hansfn commentedIn Drupal 7 I just had:
How do you properly define the samething? As a subclass of \Drupal\Core\TypedData\Plugin\DataType\Map? How?
Comment #3
fagoYes, 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.
I hope that helps!
Comment #4
fagoComment #5
hansfn CreditAttribution: hansfn commentedHi, fago.
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 ...
I didn't reopen the issue since I realize that you are busy, but if you have some free time please consider adding that code sample to the docs ;-)