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.
Comments
Comment #1
fagoYep, to support that we'd need to add write-support for the respective entity-API property in entity_property_text_formatted_info().
Comment #2
Itangalo commentedComment #3
hellomobe commentedI 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.
Comment #4
akamaus commented> 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.
Comment #5
akamaus commentedI'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.
Comment #7
mitchell commentedComment #8
sepgil commentedI've opened a new issue in the entity api issue queue, since the problem lays there: #1788764: Writable text format.