public function getExcerpt($length = 200, $includeTitle = false, $focus = null)
{
$excerptParts = [];
if (!empty($this->contenttype['fields'])) {
foreach ($this->contenttype['fields'] as $key => $field) {
// Skip empty fields, and fields used as 'title'.
if (!isset($this->values[$key]) || in_array($key, $this->getTitleColumnName())) {
continue;
}
// add 'text', 'html' and 'textarea' fields.
if (in_array($field['type'], ['text', 'html', 'textarea'])) {
$excerptParts[] = $this->values[$key];
}
// add 'markdown' field
if ($field['type'] === 'markdown') {
$excerptParts[] = $this->app['markdown']->text($this->values[$key]);
}
}
}
$excerpter = new Excerpt(implode(' ', $excerptParts), $this->getTitle());
$excerpt = $excerpter->getExcerpt($length, $includeTitle, $focus);
return new \Twig_Markup($excerpt, 'UTF-8');
}