diff --git a/core/lib/Drupal/Core/Theme/Registry.php b/core/lib/Drupal/Core/Theme/Registry.php index aa07fa9..8c9efb3 100644 --- a/core/lib/Drupal/Core/Theme/Registry.php +++ b/core/lib/Drupal/Core/Theme/Registry.php @@ -448,9 +448,9 @@ protected function processExtension(&$cache, $name, $type, $theme, $path) { $result[$hook]['includes'][] = $include_file; } - // Templates are the default implementation for a theme hook. If a - // theme hook provides a theme function callback, check to ensure that - // it actually exists. + // A template file is the default implementation for a theme hook, but + // if the theme hook specifies a function callback instead, check to + // ensure the function actually exists. if (isset($info['function']) && !function_exists($info['function'])) { throw new \BadFunctionCallException(sprintf( 'Theme hook "%s" refers to a theme function callback that does not exist: "%s"', diff --git a/core/modules/system/system.api.php b/core/modules/system/system.api.php index f80f9bd..c6a2281 100644 --- a/core/modules/system/system.api.php +++ b/core/modules/system/system.api.php @@ -980,22 +980,20 @@ function hook_help($route_name, \Drupal\Core\Routing\RouteMatchInterface $route_ * theme path will be used, but if the file will not be in the default * path, include it here. This path should be relative to the Drupal root * directory. - * - template: If specified, this theme implementation is a template, and - * this is the template file without an extension. If neither 'template' - * nor 'function' is specified, a default template name will be assumed. - * For example, if a module registers the 'search_result' theme hook, - * 'search-result' will be assigned to its template. Do not put .html.twig - * on this file, that extension will be added automatically by the default - * rendering engine (which is Twig). If 'path' above is specified, the - * template should also be in this path. + * - template: If specified, the theme implementation is a template file, and + * this is the template name. Do not add 'html.twig' on the end of the + * template name. The extension will be added automatically by the default + * rendering engine (which is Twig.) If 'path' is specified, 'template' + * should also be specified. If neither 'template' nor 'function' are + * specified, a default template name will be assumed. For example, if a + * module registers the 'search_result' theme hook, 'search-result' will be + * assigned as its template name. * - function: If specified, this will be the function name to invoke for * this implementation. If neither 'template' nor 'function' is specified, - * a default template name will be assumed. For example, if a module - * registers the 'search_result' theme hook, 'search-result' will be - * assigned to its template. Do not put .html.twig on this file, - * that extension will be added automatically by the default - * rendering engine (which is Twig). If 'path' above is specified, the - * template should also be in this path. + * a default template name will be assumed. If neither 'template' nor + * 'function' are specified, a default template name will be assumed. For + * example, if a module registers the 'search_result' theme hook, + * 'search-result' will be assigned as its template name. * - base hook: Used for _theme() suggestions only: the base theme hook name. * Instead of this suggestion's implementation being used directly, the base * hook will be invoked with this implementation as its first suggestion. diff --git a/core/modules/views/views.module b/core/modules/views/views.module index 12aaa14..dda2b55 100644 --- a/core/modules/views/views.module +++ b/core/modules/views/views.module @@ -166,9 +166,9 @@ function views_theme($existing, $type, $theme, $path) { if (!isset($def['theme']) || empty($def['register_theme'])) { continue; } - // For each theme registration we a base directory to look for the - // templates folder. This will be in any case the root of the given module - // so we always need a module definition. + // For each theme registration, we have a base directory to check for the + // templates folder. This will be relative to the root of the given module + // folder, so we always need a module definition. // @todo: watchdog or exception? if (!isset($def['provider']) || !$module_handler->moduleExists($def['provider'])) { continue; @@ -196,7 +196,7 @@ function views_theme($existing, $type, $theme, $path) { $hooks[$def['theme']]['file'] = $def['theme_file']; } - // Whenever we got a theme file, we include it directly so we can + // Whenever we have a theme file, we include it directly so we can // auto-detect the theme function. if (isset($def['theme_file'])) { $include = DRUPAL_ROOT . '/' . $module_dir . '/' . $def['theme_file'];