Allow to set id + custom attributes to hinclude tag
Squashed commits: Allow to set an id attribute to hinclude tag Allow custom attributes on hinclude tag
This commit is contained in:
parent
e8b7f0fd34
commit
342d08967c
@ -93,7 +93,13 @@ class HIncludeFragmentRenderer extends RoutableFragmentRenderer
|
||||
$content = $template;
|
||||
}
|
||||
|
||||
return new Response(sprintf('<hx:include src="%s">%s</hx:include>', $uri, $content));
|
||||
$attrOptions = isset($options['attr']) && is_array($options['attr']) ? $options['attr'] : array();
|
||||
$attributes = array();
|
||||
foreach($attrOptions as $attribute => $value) {
|
||||
$attributes[] = sprintf('%s="%s"', $attribute, $value);
|
||||
}
|
||||
|
||||
return new Response(sprintf('<hx:include src="%s" %s>%s</hx:include>', $uri, implode(" ", $attributes), $content));
|
||||
}
|
||||
|
||||
private function templateExists($template)
|
||||
|
Reference in New Issue
Block a user