2

I am working with Rules to set a node's body. Based on the data selector, the node body requires a text_formatted type as input.

Currently, my custom event only provides a plain 'text' Rules data type. Is there a way I can programmatically convert the plain text to text_formatted? And when and where should it happen?

1 Answer 1

1

I tried fixing this myself but I'm not sure if this is the best.

I took a peek at entity/includes/entity.property.inc and found the definition of entity_property_text_formatted_info() enough for me to define it properly.

I simply wrapped the plain 'text' with an array definition of a

    $text_formatted = array('value' => $text_plain,
                            'summary' => $text_plain,
                            'format' => 'full_html');

And fed $text_formatted to the event invoke call.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.