You are here

protected function QuizQuestionEntityTrait::getFormat in Quiz 8.6

Same name and namespace in other branches
  1. 8.5 src/Entity/QuizQuestionEntityTrait.php \Drupal\quiz\Entity\QuizQuestionEntityTrait::getFormat()
  2. 6.x src/Entity/QuizQuestionEntityTrait.php \Drupal\quiz\Entity\QuizQuestionEntityTrait::getFormat()

Utility function that returns the format of the node body.

Return value

string|null The format of the node body

File

src/Entity/QuizQuestionEntityTrait.php, line 202

Class

QuizQuestionEntityTrait
A trait all Quiz question strongly typed entity bundles must use.

Namespace

Drupal\quiz\Entity

Code

protected function getFormat() {
  $node = isset($this->node) ? $this->node : $this->question;
  $body = field_get_items('node', $node, 'body');
  return isset($body[0]['format']) ? $body[0]['format'] : NULL;
}