I'd like to change the the text format of the a long text field - I deleted the default body field because I didn't want the summary and created a long text field called field_body. The node is for imported blog posts - I need to change the text format from plain text to full html after saving.

I've set up the rules as:
Event - > After saving new content
Conditions -> Content is type of ->node, blog
Actions->set a data value->Data selector ->node:body-field:format

The following error is returned.
The integrity check failed with the following error message: "The selected data property doesn't support writing."

How I should configure this correctly, if it's possible.

CommentFileSizeAuthor
#5 1198380_rules_entity_set_format.patch470 bytesakamaus

Comments

fago’s picture

Component: Rules Core » Rules Engine

Yep, to support that we'd need to add write-support for the respective entity-API property in entity_property_text_formatted_info().

Itangalo’s picture

Category: support » feature
hellomobe’s picture

Status: Active » Closed (works as designed)

I actually used check_markup($field, 'full_html') in the .tpl file to change/override the output display (which is the goal). This is actually a much better way to go in my opinion since it's not a good idea to change the text-format in the database to a format that the user doesn't have permission to use -- he/she then wouldn't be able to edit the field as a side effect. Second, being able to use check_markup, Rules seems overkill in this case.

I'm going to go ahead and close this and someone can reopen it if there really is a need.

akamaus’s picture

Status: Closed (works as designed) » Needs work

> Second, being able to use check_markup, Rules seems overkill in this case.
I guess, everything Rules are useful for could also be done in plain php. The question here is modularity. In my case I have a rule which creates a node and populates the body. Despite the fact that the default input format is set for the content type, the newly created node isn't rendered properly. Manual editing and saving of the node fixes the format and solves the problem.

I have a strong feeling that setting the desired input format right in the rule filling the field is far more elegant and logical than modifying the theme.

akamaus’s picture

Status: Needs work » Needs review
StatusFileSize
new470 bytes

I've followed fago's advice and added a setter callback to format property in the entity_api module. Hope it's appropriate to discuss it here.

Although it works, my patch is almost certainly invalid as it ignores access restrictions. But I'm not sure how to take them into account.
There is a 'setter permission', but in this situation we need to somehow dynamically decide if the user allowed to set a particular input format.

Also I stumbled upon http://drupal.org/node/1033642 which looks like a similar problem.

Status: Needs review » Needs work

The last submitted patch, 1198380_rules_entity_set_format.patch, failed testing.

mitchell’s picture

Version: 7.x-2.0-beta2 » 7.x-2.x-dev
sepgil’s picture

Component: Rules Engine » Rules Core
Status: Needs work » Closed (works as designed)

I've opened a new issue in the entity api issue queue, since the problem lays there: #1788764: Writable text format.