Closed (fixed)
Project:
Rules
Version:
7.x-2.x-dev
Component:
Rules Core
Priority:
Major
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
25 Jul 2013 at 19:49 UTC
Updated:
4 Jan 2014 at 03:57 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
fagoSo attached patch adds in support for class-based event,action,condition definition - including a simple discovery mechanism based on the already existing possibility to expose additional files to Rules via hook_rules_file_info().
So a class must reside in module.rules.inc, in a file specified in hook_rules_file_info() or in any other included location and support auto-loading, e.g. via the registry. Then, the class must implement the suiting interface as well as a static getInfo() method providing the plugin info. Compared to info provided via info-hooks getInfo() must include the plugin 'name' and the providing 'module'.
Attached patch implements that and converts node conditions to classes to have an example.
Comment #2
fagoops, previous patch contained other patches as well - please ignore.
See attached patch.
Comment #3
fagoComment #4
fubhy commentedweird line break.
Let's try solving this with ReflectionClass::getFileName() and then doing a while() loop using dirname() to find the module through a keyed list of module names (keys being the paths to the modules).
Comment #6
fagoRealized I forgot a rather crucial line -> upated patch.
Not addressing #4 yet - the suggestion for determining the module sounds good though!
Comment #8
fagoNoticed I forgot to move over the node-type-assertion callbacks - yes, callbacks are easy to loose. Hopefully this fixes tests.
Comment #10
fagoGood, so this optimises things a bit more, auto-detects the module key, adds hook_rules_directory() and documentation.
Comment #11
fagotagging
Comment #12
fubhy commentedVery good. Discovery looks much better now. Maybe add a test for that?
Comment #13
fagoIt's already indirectly tested with conditions, but yes we should add an explicit test case for it as well.
Updated patch with improved hook_rules_directory() which now allows modules to expose directories for other modules.
Comment #14
fagoAdded tests.
Comment #15
fagoCommitted.