public function GTMContainer::inlineTag in GoogleTagManager 7.2
Returns tag array for the snippet type.
Parameters
string $type: The snippet type.
int $weight: The weight of the item.
Return value
array The tag array. [not used]
File
- includes/
entity/ container.inc, line 574
Class
- GTMContainer
- Defines the container configuration entity.
Code
public function inlineTag($type, $weight) {
$uri = $this
->snippetURI($type);
$url = drupal_realpath($uri);
$contents = @file_get_contents($url);
drupal_add_js($contents, array(
'type' => 'inline',
'group' => JS_LIBRARY * 2,
'requires_jquery' => FALSE,
));
// This approach uses weight only but does not group the script tags so
// difficult to put this at or near top of them.
// drupal_add_html_head($attachment[0], $attachment[1]);
$attachment = array(
$contents ? array(
'#type' => 'html_tag',
'#tag' => 'script',
'#value' => $contents,
'#weight' => $weight,
) : array(
'#type' => 'ignore_tag',
),
"google_tag_{$type}_tag__{$this->id()}",
);
return $attachment;
}