/** * Register LC widget resources * * @return void */ protected function registerLCResources() { foreach (\XLite\View\AView::getRegisteredResources() as $type => $files) { $method = 'drupal_add_' . $type; if (function_exists($method)) { foreach ($files as $name => $data) { // $method assembled from 'drupal_add_' + $type $method($data['file'], $this->getResourceInfo($type, $data)); } } } $metas = trim(implode(PHP_EOL, \XLite\View\AView::getRegisteredMetas())); if ($metas) { $dom = new \DOMDocument('1.0', 'UTF-8'); $string = '<' . '?xml version="1.0" encoding="UTF-8"?' . '><body>' . $metas . '</body>'; if (@$dom->loadHTML($string)) { $i = 0; foreach ($dom->getElementsByTagName('body')->item(0)->childNodes as $node) { if ($node instanceof \DOMNode) { $tag = array('#type' => 'html_tag', '#tag' => $node->nodeName, '#attributes' => array()); foreach ($node->attributes as $attribute) { $tag['#attributes'][$attribute->name] = $attribute->value; } drupal_add_html_head($tag, 'lc3' . $i); $i++; } } } } }