public function Container::inlineTag in GoogleTagManager 8
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.
File
- src/
Entity/ Container.php, line 583
Class
- Container
- Defines the container configuration entity.
Namespace
Drupal\google_tag\EntityCode
public function inlineTag($type, $weight) {
$contents = $this
->getSnippetContents($type);
$attachment = [
$contents ? [
'#type' => 'html_tag',
'#tag' => 'script',
'#value' => new FormattableMarkup($contents, []),
'#weight' => $weight,
] : [
'#type' => 'ignore_tag',
],
"google_tag_{$type}_tag__{$this->id()}",
];
return $attachment;
}