0

In node type = "article", I have field of type body.

enter image description here

In my .module file, I want to get its raw source code with actual html classes too. But all I get is:

enter image description here

$body = $node->get('field_all_body')->value;
print_r($body);die;

I want the value should contain div class too. How it can be achieved?

My actual requirement is: I want to populate one field value on behalf of the class exists in 'field_all_body' field.

Foe example, I select some text in text-editor, and mark it bold, then that particular text should get cloned in another field too.

1 Answer 1

1

The basic text format filters out all but a few HTML tags. You want to select the Full HTML text format to keep your divs and classes.

2
  • I changed the format to full_html but still it won't reflected the classes inside. Jan 17, 2018 at 11:19
  • CKEditor might be doing some filtering. You may have to change it's settings to for the full html filter to allow this. Alternatively, you can make a filter that does not use CKEditor. I tend to have a "no change html' filter that is just a text box for this.
    – CG Monroe
    Jan 18, 2018 at 18:40

Your Answer

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

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