Conditional actions is fighting hard against my will to add additional information to some predicates.

(1) CA doesn't use drupal_write_record(), so you cannot simply add a column to the database
(2) There is a hook_ca_predicate_alter(), but it is only called for predicates stored in code
(3) ca_predicate_meta_form_submit() only saves the default predicate fields, so you cannot hook_form_alter() that to add additional meta-data to the predicate anyway.

I suggest we add a $predicate['#data'] field, and make sure that other modules can use that to store additional meta-data. It's the less intrusive change that I can think of.

Comments

damien tournoud’s picture

Status: Active » Needs review
StatusFileSize
new4.13 KB

Here is a (minimal) patch.

damien tournoud’s picture

StatusFileSize
new4.67 KB

Small correction: we also need to save the predicate_data value in ca_predicate_meta_form_submit().

longwave’s picture

StatusFileSize
new1.21 KB

I was looking for a similar feature, but I was looking to alter default predicates rather than add metadata. However, (2) confused me - there is no hook_ca_predicate_alter() as far as I can see. The attached patch adds this.

longwave’s picture

Committed #3.

#2 is over a year old, I currently have no use for this and am not sure I can see the need - what "extra information" do you need to add to predicates? - but I will consider committing if someone still finds it useful.

longwave’s picture

Status: Needs review » Closed (won't fix)

Please reopen with an example use case if this is still required.