FAQ | This is a LIVE service | Changelog

Skip to content
Snippets Groups Projects

Feature/am 427 sidebar only basic html

Merged A. Michaels requested to merge feature/am-427-sidebar-only-basic-html into main
1 file
+ 6
10
Compare changes
  • Side-by-side
  • Inline
@@ -221,12 +221,6 @@ class MigrateCleanupCommand extends DrushCommands {
}
return true;
}
// Always preserve Drupal-specific tags
$drupal_tags = ['drupal-entity', 'drupal-media'];
if (in_array(strtolower($node->nodeName), $drupal_tags)) {
return true;
}
// If it's a script or style element, remove it.
if (in_array(strtolower($node->nodeName), ['script', 'style'])) {
@@ -257,11 +251,13 @@ class MigrateCleanupCommand extends DrushCommands {
}
}
// If the node has no children and no text content, mark it for removal.
// Only check specific tags for emptiness
$tags_to_check = ['p', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'strong', 'b', 'em', 'i',
'small', 'mark', 'del', 'ins', 'sub', 'sup', 'q', 'cite', 'pre'];
// If the node has no children and no text content, check if it's in our list of tags to check
if (!$keep_node && $node->childNodes->length === 0) {
// Check if the node is not a self-closing tag like <img>, <br>, etc.
$self_closing_tags = ['img', 'br', 'hr', 'input', 'meta', 'link'];
if (!in_array(strtolower($node->nodeName), $self_closing_tags)) {
if (in_array(strtolower($node->nodeName), $tags_to_check)) {
return false;
}
}
Loading