private function BlazyFilter::validNodes in Blazy 8.2
Return valid nodes based on the allowed tags.
1 call to BlazyFilter::validNodes()
- BlazyFilter::process in src/
Plugin/ Filter/ BlazyFilter.php - Performs the filter processing.
File
- src/
Plugin/ Filter/ BlazyFilter.php, line 622
Class
- BlazyFilter
- Provides a filter to lazyload image, or iframe elements.
Namespace
Drupal\blazy\Plugin\FilterCode
private function validNodes(\DOMDocument $dom, array $allowed_tags = []) {
$valid_nodes = [];
foreach ($allowed_tags as $allowed_tag) {
$nodes = $dom
->getElementsByTagName($allowed_tag);
if ($nodes->length > 0) {
foreach ($nodes as $node) {
if ($node
->hasAttribute('data-unblazy')) {
continue;
}
$valid_nodes[] = $node;
}
}
}
return $valid_nodes;
}