I need to define custom html.html.twig file for particular url. What I did is given below:
/**
* Implements hook_theme().
*/
function mymodule_theme() {
return array(
'html__ajax' => array(
'render element' => 'elements',
),
);
}
/**
* Implements hook_theme_suggestions_HOOK().
*/
function mymodule_theme_suggestions_html(array $variables) {
$template_suggestions = array();
// This is used to display only ajax $content.
if (isset($_GET['ajax']) && $_GET['ajax'] == 1) {
$template_suggestions[] = 'html__ajax';
}
return $template_suggestions;
}
I have copy pasted html.html.twig file from my theme and put it inside my module's template folder and renamed it as html--ajax.html.twig. Changes are reflecting fine but not all default variables are not available in my custom html.html.twig file.
When I open the page I can see the content till Skip to main content
link. Please help me what I am missing while declaring custom template file.