mirror of
https://github.com/getgrav/grav.git
synced 2026-07-19 22:21:56 +02:00
Bit more flexible!
This commit is contained in:
@@ -465,12 +465,25 @@ abstract class Utils
|
||||
|
||||
public static function getHtmlFromExcerpt($excerpt)
|
||||
{
|
||||
// needs to be more flexible.. this is a rough pass for testing
|
||||
$html = '<' . $excerpt['element']['name'] . ' ';
|
||||
foreach ($excerpt['element']['attributes'] as $name => $value) {
|
||||
$html .= $name . '="' . $value . '" ';
|
||||
$element = $excerpt['element'];
|
||||
$html = '<'.$element['name'];
|
||||
|
||||
if (isset($element['attributes'])) {
|
||||
foreach ($element['attributes'] as $name => $value) {
|
||||
if ($value === null) {
|
||||
continue;
|
||||
}
|
||||
$html .= ' '.$name.'="'.$value.'"';
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($element['text'])) {
|
||||
$html .= '>';
|
||||
$html .= $element['text'];
|
||||
$html .= '</'.$element['name'].'>';
|
||||
} else {
|
||||
$html .= ' />';
|
||||
}
|
||||
$html .= '/>';
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user