Unable to find template in Drupal theme registry

by Rajeev Paul   Last Updated November 15, 2017 05:07 AM

I have created module with hook_theme

     function mymodule_theme($existing, $type, $theme, $path) {

          return [
            'mymodule_order_incomplete' => [
              'variables' => ['test_var' => NULL],
              ],
          ];


  }

also in page callback

namespace Drupal\mymodule\Controller;

use Drupal\Core\Controller\ControllerBase;

/**
 * Provides route responses for the Example module.
 */
class MymoduleCompleteController extends ControllerBase {

  /**
   * Returns a simple page.
   *
   * @return array
   *   A simple renderable array.
   */
  public function test_complete() {


    return [
      '#theme' => 'mymodule_order_incomplete',
      '#test_var' => $this->t('Test Value'),
    ];

  }

after i took the page i am getting unexpected error.See the error in watchdog

(Drupal\Core\Template\Loader\ThemeRegistryLoader: Unable to find template "modules/mymodule/templates/mymodule-order-incomplete.html.twig" in the Drupal theme registry.)

Tags : theming


Related Questions


Features can export everything?

Updated March 26, 2015 10:02 AM


No image style found

Updated March 29, 2015 15:02 PM


Best way to have 5 or 6 themes in one site drupal 7

Updated April 09, 2015 22:03 PM