AssetHtmlTagRenderElementTrait.php in HTTP/2 Server Push 8
File
src/Asset/AssetHtmlTagRenderElementTrait.php
View source
<?php
namespace Drupal\http2_server_push\Asset;
trait AssetHtmlTagRenderElementTrait {
protected static function isLinkRelStylesheet(array $element) {
return isset($element['#type']) && $element['#type'] === 'html_tag' && (isset($element['#tag']) && $element['#tag'] === 'link') && (isset($element['#attributes']) && isset($element['#attributes']['rel']) && $element['#attributes']['rel'] === 'stylesheet');
}
protected static function isScript(array $element) {
return isset($element['#type']) && $element['#type'] === 'html_tag' && (isset($element['#tag']) && $element['#tag'] === 'script');
}
protected static function isUnconditional(array $element) {
return empty($element['#browsers']) || $element['#browsers']['!IE'] === TRUE && $element['#browsers']['IE'] === TRUE;
}
protected static function hasRootRelativeUrl(array $element, $attribute_name) {
$attribute_value = $element['#attributes'][$attribute_name];
return $attribute_value[0] === '/' && $attribute_value[1] !== '/';
}
}