I my custom content type having a field body which is of type "Long text and summary" and $node object of it does not contain any safe_value as you're checking in block_inject.module.
if (isset($node->body[$language_content->language])) {
$body = $node->body[$language_content->language]['0']['safe_value'];
}
So please tell me what needs to be done.
Also I'v read from http://www.computerminds.co.uk/articles/rendering-drupal-7-fields-right-way that
$output = field_view_field('node', $node, 'field_name');
is portable and right way to get body field's value.
Comments
Comment #1
upchuk commentedHello!
Thanks for letting me know. Can you please tell me what exactly did you do to encounter this issue? How come you don't have the safe_value? What kind of custom content type did you create?
Thanks!
D
Comment #2
rag_gupta commentedI've no idea why this safe_value isn't there. I myself was unaware about it. Mine is the latest Drupal code(recently updated).
For time being I've simply replaced the 'safe_value' with 'value' and it's working fine.
It wasn't working with my three content types which describe company jobs. I understand when we create a node type content type the Body field comes by default. So I'm not sure why it isn't there.
I've checked my another site using D7 and through Devel tab I can't find this value in the body either.
Comment #3
upchuk commentedThat is very weird..Do your article and basic page content types also lack the safe_value for the body?
Comment #4
upchuk commentedAre you using the Node Embed module or some particular module that deals with nodes or text filters?
Comment #5
rag_gupta commentedNo idea. I've checked the node of page type( ie about us page) and there is no safe_value. Pl. see the screenshot. I'm also uploading list of enabled modules.
Comment #6
rag_gupta commentedPl. delete this file: Graphic_15-Oct-13 7_39_57 PM.png in the last post.
Here is the correct one.
Comment #7
upchuk commentedI think one of the modules has disabled the appearance of the safe_value item. Do a cross check of the modules you use on both sites you mentioned and try disabling one by one to see which one it is. You should have the safe_value there..
Star maybe with these ones: simplehtmldom API, Text formatter (textformatter). Maybe it has something with the text formatting.
Lemme know how it goes.
Comment #8
upchuk commentedi cannot delete the file..
Comment #9
rag_gupta commentedYes you're right .. I'll check sometime which filter is removing this value and why. This is of concern.
Moreover safe_value will not work I think if I use basic text format because then html special characters will be encoded.
Comment #10
upchuk commentedsafe_value should be there for all the normal text formats: plain text, filter html, full html...
D
Comment #11
upchuk commentedComment #11.0
upchuk commentedminor grammar correction