I'm trying to print a markup in a peg. I've implemented a function passed the values through the variables. Also I've implemented a custom theme function with a markup.
But it is giving the error.
Template "modules/custom/example/templates/example.html.twig" is not defined (Drupal\Core\Template\Loader\ThemeRegistryLoader: Unable to find template "modules/custom/example/templates/example.html.twig" in the Drupal theme registry.).
Here is my code.
/**
* Implements hook_theme().
*/
function example_theme($existing, $type, $theme, $path) {
return array(
'example' => array(
'variables' => array('items' => array()),
),
);
}
// Theme function
function theme_example($variables) {
return 'hi'
}
// Preprocess implementation.
function template_preprocess_example(&$variables) {
$value = 'hi how are you';
return $value;
}
I've implemented both one after another, but they didn't work. Is the custom theme function format changed in Drupal 8?