I want to define a new phtml block in the head of my module: I try to add something like this in my app/code/Custom/Module/view/frontend/layout/default.xml
file:
<?xml version="1.0"?>
<page xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<body>
<referenceBlock name="head.additional">
<block class="Custom\Module\Block\Hello" name="mycustom" template="Custom_Module::mycustom.phtml" />
</referenceBlock>
</body>
</page>
the phtml file must be loaded in the head and in the phtml file I have only a small javascript that will call a slider.
$('.slideshow').banner({image :"images/slide1.png"});
How I can create Custom\Module\Block\Hello
block and what must contain this file?
Thank you
UPDATE:
<script type="text/javascript">
require([
'jquery',
'banner'
], function($, banner){
$(function(){
$(document).banner({});
})
});
</script>
<div class="snowme">Text me</div>