Update Post.php
This commit is contained in:
@@ -170,12 +170,19 @@ public function getHtmlBodyAttribute()
|
|||||||
$figureElement->appendChild($imgElement);
|
$figureElement->appendChild($imgElement);
|
||||||
$figureElement->setAttribute('class', 'image');
|
$figureElement->setAttribute('class', 'image');
|
||||||
|
|
||||||
// Create a new <footer> element inside <figure>
|
// Create a new <footer> element inside <figure> without directly setting its content
|
||||||
$footerElement = new \DOMElement('footer', $imgElement->getAttribute('alt'));
|
$footerElement = $imgElement->ownerDocument->createElement('footer');
|
||||||
$figureElement->appendChild($footerElement);
|
$figureElement->appendChild($footerElement);
|
||||||
|
|
||||||
|
// Add the content to <footer> using createTextNode to ensure special characters are handled
|
||||||
|
$footerText = $imgElement->ownerDocument->createTextNode($imgElement->getAttribute('alt'));
|
||||||
|
$footerElement->appendChild($footerText);
|
||||||
|
|
||||||
|
// Set the class attribute for <footer>
|
||||||
$footerElement->setAttribute('class', 'image-caption');
|
$footerElement->setAttribute('class', 'image-caption');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
// Add Bootstrap 5 styling to tables
|
// Add Bootstrap 5 styling to tables
|
||||||
$crawler->filter('table')->each(function (Crawler $node) {
|
$crawler->filter('table')->each(function (Crawler $node) {
|
||||||
$tableElement = $node->getNode(0);
|
$tableElement = $node->getNode(0);
|
||||||
|
|||||||
Reference in New Issue
Block a user