1 filter.module filter_parse_file_fids($text)

Parse an HTML snippet for any data-file-id attributes.

Parameters

string $text: The partial (X)HTML snippet to load. Invalid markup will be corrected on import.

Return value

array: An array of all found FIDs.

File

core/modules/filter/filter.module, line 1785
Framework for handling the filtering of content.

Code

function filter_parse_file_fids($text) {
  $dom = filter_dom_load($text);
  $xpath = new DOMXPath($dom);
  $fids = array();
  foreach ($xpath->query('//*[@data-file-id]') as $node) {
    $fids[] = $node->getAttribute('data-file-id');
  }
  return $fids;
}