diff --git a/CHANGELOG-WIP.md b/CHANGELOG-WIP.md index db461cb6f4f..772eff76579 100644 --- a/CHANGELOG-WIP.md +++ b/CHANGELOG-WIP.md @@ -51,6 +51,7 @@ - Element query date params now support passing `today`, `tomorrow`, and `yesterday`. ([#10485](https://github.com/craftcms/cms/issues/10485)) - Element queries now support passing ambiguous column names (e.g. `dateCreated`) and field handles into `select()`. ([#11790](https://github.com/craftcms/cms/pull/11790), [#11800](https://github.com/craftcms/cms/pull/11800)) - `{% cache %}` tags now store any HTML registered with `{% html %}` tags. ([#11811](https://github.com/craftcms/cms/discussions/11811)) +- Control panel `.twig` templates are now prioritized over `.html`. ([#11809](https://github.com/craftcms/cms/discussions/11809), [#11840](https://github.com/craftcms/cms/pull/11840)) - `craft\helpers\Component::iconSvg()` now namespaces the SVG contents, and adds `aria-hidden="true"`. ([#11703](https://github.com/craftcms/cms/pull/11703)) - `craft\services\Search::EVENT_BEFORE_INDEX_KEYWORDS` is now cancellable by setting `$event->isValid` to `false`. ([#11705](https://github.com/craftcms/cms/discussions/11705)) - `checkboxSelect` inputs without `showAllOption: true` now post an empty value if no options were selected. ([#11748](https://github.com/craftcms/cms/issues/11748)) diff --git a/src/assetpreviews/Image.php b/src/assetpreviews/Image.php index a28720c44e5..e76839bb3bb 100644 --- a/src/assetpreviews/Image.php +++ b/src/assetpreviews/Image.php @@ -34,7 +34,7 @@ public function getPreviewHtml(array $variables = []): string ]); } - return Craft::$app->getView()->renderTemplate('assets/_previews/image', + return Craft::$app->getView()->renderTemplate('assets/_previews/image.twig', array_merge([ 'asset' => $this->asset, 'url' => $url, diff --git a/src/assetpreviews/Text.php b/src/assetpreviews/Text.php index 4ef18e8d113..254d7c8fd77 100644 --- a/src/assetpreviews/Text.php +++ b/src/assetpreviews/Text.php @@ -31,7 +31,7 @@ public function getPreviewHtml(array $variables = []): string FileHelper::unlink($localCopy); $language = $this->asset->kind === Asset::KIND_HTML ? 'markup' : $this->asset->kind; - return Craft::$app->getView()->renderTemplate('assets/_previews/text', + return Craft::$app->getView()->renderTemplate('assets/_previews/text.twig', array_merge([ 'asset' => $this->asset, 'language' => $language, diff --git a/src/assetpreviews/Video.php b/src/assetpreviews/Video.php index 4ebad587732..510e2fd5380 100644 --- a/src/assetpreviews/Video.php +++ b/src/assetpreviews/Video.php @@ -30,7 +30,7 @@ public function getPreviewHtml(array $variables = []): string throw new NotSupportedException('Preview not supported.'); } - return Craft::$app->getView()->renderTemplate('assets/_previews/video', + return Craft::$app->getView()->renderTemplate('assets/_previews/video.twig', array_merge([ 'asset' => $this->asset, 'url' => $url, diff --git a/src/base/MissingComponentTrait.php b/src/base/MissingComponentTrait.php index 350108e6aa0..9517b1da136 100644 --- a/src/base/MissingComponentTrait.php +++ b/src/base/MissingComponentTrait.php @@ -128,7 +128,7 @@ public function getPlaceholderHtml(): string } } - return Craft::$app->getView()->renderTemplate('_special/missing-component', compact( + return Craft::$app->getView()->renderTemplate('_special/missing-component.twig', compact( 'error', 'showPlugin', 'isComposerInstalled', diff --git a/src/base/Plugin.php b/src/base/Plugin.php index 1d1cbf0fe1d..bb7b22075fa 100644 --- a/src/base/Plugin.php +++ b/src/base/Plugin.php @@ -206,7 +206,7 @@ public function getSettingsResponse(): mixed /** @var Controller $controller */ $controller = Craft::$app->controller; - return $controller->renderTemplate('settings/plugins/_settings', [ + return $controller->renderTemplate('settings/plugins/_settings.twig', [ 'plugin' => $this, 'settingsHtml' => $settingsHtml, ]); diff --git a/src/controllers/AssetsController.php b/src/controllers/AssetsController.php index a5d7f570164..bc0e8b53938 100644 --- a/src/controllers/AssetsController.php +++ b/src/controllers/AssetsController.php @@ -764,7 +764,7 @@ public function actionImageEditor(): Response $focal = $asset->getHasFocalPoint() ? $asset->getFocalPoint() : null; - $html = $this->getView()->renderTemplate('_special/image_editor'); + $html = $this->getView()->renderTemplate('_special/image_editor.twig'); return $this->asJson(['html' => $html, 'focalPoint' => $focal]); } diff --git a/src/controllers/BaseUpdaterController.php b/src/controllers/BaseUpdaterController.php index 8abec982600..f64909ffe0b 100644 --- a/src/controllers/BaseUpdaterController.php +++ b/src/controllers/BaseUpdaterController.php @@ -97,7 +97,7 @@ public function actionIndex(): Response $stateJs = Json::encode($state); $this->getView()->registerJs("Craft.updater = (new Craft.Updater($idJs)).setState($stateJs);"); - return $this->renderTemplate('_special/updater', [ + return $this->renderTemplate('_special/updater.twig', [ 'title' => $this->pageTitle(), ]); } diff --git a/src/controllers/CategoriesController.php b/src/controllers/CategoriesController.php index 9f2de7c9883..2ed9bf16fc1 100644 --- a/src/controllers/CategoriesController.php +++ b/src/controllers/CategoriesController.php @@ -58,7 +58,7 @@ public function actionGroupIndex(): Response $groups = Craft::$app->getCategories()->getAllGroups(); - return $this->renderTemplate('settings/categories/index', [ + return $this->renderTemplate('settings/categories/index.twig', [ 'categoryGroups' => $groups, ]); } @@ -113,7 +113,7 @@ public function actionEditCategoryGroup(?int $groupId = null, ?CategoryGroup $ca $variables['groupId'] = $groupId; $variables['categoryGroup'] = $categoryGroup; - return $this->renderTemplate('settings/categories/_edit', $variables); + return $this->renderTemplate('settings/categories/_edit.twig', $variables); } /** @@ -225,7 +225,7 @@ public function actionCategoryIndex(?string $groupHandle = null): Response 'New category', ]); - return $this->renderTemplate('categories/_index', [ + return $this->renderTemplate('categories/_index.twig', [ 'groupHandle' => $groupHandle, 'groups' => $groups, ]); @@ -549,7 +549,7 @@ public function actionInputHtml(): Response } } - $html = $this->getView()->renderTemplate('_components/fieldtypes/Categories/input', + $html = $this->getView()->renderTemplate('_components/fieldtypes/Categories/input.twig', [ 'elements' => $categories, 'id' => $this->request->getParam('id'), diff --git a/src/controllers/DashboardController.php b/src/controllers/DashboardController.php index 4fa495d44f3..fc7cfbb1428 100644 --- a/src/controllers/DashboardController.php +++ b/src/controllers/DashboardController.php @@ -142,7 +142,7 @@ public function actionIndex(): Response $variables['widgetTypes'] = $widgetTypeInfo; - return $this->renderTemplate('dashboard/_index', $variables); + return $this->renderTemplate('dashboard/_index.twig', $variables); } /** @@ -301,7 +301,7 @@ public function actionSendSupportRequest(): Response $getHelpModel->attachment = UploadedFile::getInstanceByName($namespace . 'attachAdditionalFile'); if (!$getHelpModel->validate()) { - return $this->renderTemplate('_components/widgets/CraftSupport/response', [ + return $this->renderTemplate('_components/widgets/CraftSupport/response.twig', [ 'widgetId' => $widgetId, 'success' => false, 'errors' => $getHelpModel->getErrors(), @@ -434,7 +434,7 @@ public function actionSendSupportRequest(): Response } if (isset($requestException)) { - return $this->renderTemplate('_components/widgets/CraftSupport/response', [ + return $this->renderTemplate('_components/widgets/CraftSupport/response.twig', [ 'widgetId' => $widgetId, 'success' => false, 'errors' => [ @@ -445,7 +445,7 @@ public function actionSendSupportRequest(): Response ]); } - return $this->renderTemplate('_components/widgets/CraftSupport/response', [ + return $this->renderTemplate('_components/widgets/CraftSupport/response.twig', [ 'widgetId' => $widgetId, 'success' => true, 'errors' => [], diff --git a/src/controllers/ElementIndexesController.php b/src/controllers/ElementIndexesController.php index cc56a3f38bb..b64cff7eaef 100644 --- a/src/controllers/ElementIndexesController.php +++ b/src/controllers/ElementIndexesController.php @@ -294,7 +294,7 @@ public function actionGetSourceTreeHtml(): Response $sources = Craft::$app->getElementSources()->getSources($this->elementType, $this->context); return $this->asJson([ - 'html' => $this->getView()->renderTemplate('_elements/sources', [ + 'html' => $this->getView()->renderTemplate('_elements/sources.twig', [ 'elementType' => $this->elementType, 'sources' => $sources, ]), diff --git a/src/controllers/ElementSelectorModalsController.php b/src/controllers/ElementSelectorModalsController.php index c3fd64bbde8..6abf6bcb577 100644 --- a/src/controllers/ElementSelectorModalsController.php +++ b/src/controllers/ElementSelectorModalsController.php @@ -99,7 +99,7 @@ public function actionBody(): Response })(); return $this->asJson([ - 'html' => $this->getView()->renderTemplate('_elements/modalbody', [ + 'html' => $this->getView()->renderTemplate('_elements/modalbody.twig', [ 'context' => $context, 'elementType' => $elementType, 'sources' => $sources, diff --git a/src/controllers/ElementsController.php b/src/controllers/ElementsController.php index af57bdf057f..c10bafca25c 100644 --- a/src/controllers/ElementsController.php +++ b/src/controllers/ElementsController.php @@ -616,7 +616,7 @@ private function _contextMenu( $showDrafts || ($element->hasRevisions() && $element::find()->revisionOf($element)->status(null)->exists()) ) { - return Craft::$app->getView()->renderTemplate('_includes/revisionmenu', [ + return Craft::$app->getView()->renderTemplate('_includes/revisionmenu.twig', [ 'element' => $element, 'showDrafts' => $showDrafts, 'supportedSiteIds' => $propSiteIds, @@ -1187,7 +1187,7 @@ public function actionSaveDraft(): ?Response $tabs = $form->getTabMenu(); if (count($tabs) > 1) { $selectedTab = isset($tabs[$this->_selectedTab]) ? $this->_selectedTab : null; - $tabHtml = $view->namespaceInputs(fn() => $view->renderTemplate('_includes/tabs', [ + $tabHtml = $view->namespaceInputs(fn() => $view->renderTemplate('_includes/tabs.twig', [ 'tabs' => $tabs, 'selectedTab' => $selectedTab, ], View::TEMPLATE_MODE_CP), $namespace); diff --git a/src/controllers/EntriesController.php b/src/controllers/EntriesController.php index 15e3da37fb5..29f3f4f53b3 100644 --- a/src/controllers/EntriesController.php +++ b/src/controllers/EntriesController.php @@ -78,7 +78,7 @@ public function actionCreate(?string $section = null): ?Response if (!in_array($site->id, $editableSiteIds)) { // If there’s more than one possibility and entries doesn’t propagate to all sites, let the user choose if (count($editableSiteIds) > 1 && $section->propagationMethod !== Section::PROPAGATION_METHOD_ALL) { - return $this->renderTemplate('_special/sitepicker', [ + return $this->renderTemplate('_special/sitepicker.twig', [ 'siteIds' => $editableSiteIds, 'baseUrl' => "entries/$section->handle/new", ]); diff --git a/src/controllers/FieldsController.php b/src/controllers/FieldsController.php index d7cae016027..0587bdfd653 100644 --- a/src/controllers/FieldsController.php +++ b/src/controllers/FieldsController.php @@ -257,7 +257,7 @@ public function actionEditField(?int $fieldId = null, ?FieldInterface $field = n $view->registerAssetBundle(FieldSettingsAsset::class); $view->registerJs($js); - return $this->renderTemplate('settings/fields/_edit', compact( + return $this->renderTemplate('settings/fields/_edit.twig', compact( 'fieldId', 'field', 'allFieldTypes', @@ -287,7 +287,7 @@ public function actionRenderSettings(): Response $field = Craft::$app->getFields()->createField($type); $view = Craft::$app->getView(); - $html = $view->renderTemplate('settings/fields/_type-settings', [ + $html = $view->renderTemplate('settings/fields/_type-settings.twig', [ 'field' => $field, 'namespace' => $this->request->getBodyParam('namespace'), ]); diff --git a/src/controllers/FsController.php b/src/controllers/FsController.php index c6fbaeaa0b9..671f09aca85 100644 --- a/src/controllers/FsController.php +++ b/src/controllers/FsController.php @@ -49,7 +49,7 @@ public function actionIndex(): Response $variables = []; $variables['filesystems'] = Craft::$app->getFs()->getAllFilesystems(); - return $this->renderTemplate('settings/filesystems/_index', $variables); + return $this->renderTemplate('settings/filesystems/_index.twig', $variables); } /** @@ -112,7 +112,7 @@ public function actionEdit(?string $handle = null, ?Fs $filesystem = null): Resp ->addCrumb(Craft::t('app', 'Filesystems'), 'settings/filesystems') ->action('fs/save') ->redirectUrl('settings/filesystems') - ->contentTemplate('settings/filesystems/_edit', [ + ->contentTemplate('settings/filesystems/_edit.twig', [ 'oldHandle' => $handle, 'filesystem' => $filesystem, 'fsOptions' => $fsOptions, diff --git a/src/controllers/GlobalsController.php b/src/controllers/GlobalsController.php index 7d75219b71c..9937f170de3 100644 --- a/src/controllers/GlobalsController.php +++ b/src/controllers/GlobalsController.php @@ -174,7 +174,7 @@ public function actionEditContent(string $globalSetHandle, ?GlobalSet $globalSet ]); // Render the template! - return $this->renderTemplate('globals/_edit', [ + return $this->renderTemplate('globals/_edit.twig', [ 'bodyClass' => 'edit-global-set', 'editableGlobalSets' => $editableGlobalSets, 'globalSet' => $globalSet, diff --git a/src/controllers/GraphqlController.php b/src/controllers/GraphqlController.php index 139aab15273..ab77b12ed19 100644 --- a/src/controllers/GraphqlController.php +++ b/src/controllers/GraphqlController.php @@ -319,7 +319,7 @@ public function actionGraphiql(): Response $schemas[$name] = $schema->uid; } - return $this->renderTemplate('graphql/graphiql', [ + return $this->renderTemplate('graphql/graphiql.twig', [ 'url' => UrlHelper::actionUrl('graphql/api'), 'schemas' => $schemas, 'selectedSchema' => $selectedSchema, @@ -362,7 +362,7 @@ public function actionViewSchemas(): Response // Ensure the public schema is created. Craft::$app->getGql()->getPublicSchema(); - return $this->renderTemplate('graphql/schemas/_index'); + return $this->renderTemplate('graphql/schemas/_index.twig'); } /** @@ -419,7 +419,7 @@ public function actionEditToken(?int $tokenId = null, ?GqlToken $token = null): ]); } - return $this->renderTemplate('graphql/tokens/_edit', compact( + return $this->renderTemplate('graphql/tokens/_edit.twig', compact( 'token', 'title', 'accessToken', @@ -503,7 +503,7 @@ public function actionDeleteToken(): Response public function actionViewTokens(): Response { $this->requireAdmin(false); - return $this->renderTemplate('graphql/tokens/_index'); + return $this->renderTemplate('graphql/tokens/_index.twig'); } /** @@ -536,7 +536,7 @@ public function actionEditSchema(?int $schemaId = null, ?GqlSchema $schema = nul } - return $this->renderTemplate('graphql/schemas/_edit', compact( + return $this->renderTemplate('graphql/schemas/_edit.twig', compact( 'schema', 'title' )); @@ -562,7 +562,7 @@ public function actionEditPublicSchema(?GqlSchema $schema = null): Response $token = $gqlService->getPublicToken(); $title = Craft::t('app', 'Edit the public GraphQL schema'); - return $this->renderTemplate('graphql/schemas/_edit', compact( + return $this->renderTemplate('graphql/schemas/_edit.twig', compact( 'schema', 'token', 'title' diff --git a/src/controllers/ImageTransformsController.php b/src/controllers/ImageTransformsController.php index 5d991f2509c..2ada6670638 100644 --- a/src/controllers/ImageTransformsController.php +++ b/src/controllers/ImageTransformsController.php @@ -48,7 +48,7 @@ public function actionIndex(): Response $variables['transforms'] = Craft::$app->getImageTransforms()->getAllTransforms(); $variables['modes'] = ImageTransform::modes(); - return $this->renderTemplate('settings/assets/transforms/_index', $variables); + return $this->renderTemplate('settings/assets/transforms/_index.twig', $variables); } /** @@ -81,7 +81,7 @@ public function actionEdit(?string $transformHandle = null, ?ImageTransform $tra $title = Craft::t('app', 'Create a new image transform'); } - return $this->renderTemplate('settings/assets/transforms/_settings', [ + return $this->renderTemplate('settings/assets/transforms/_settings.twig', [ 'handle' => $transformHandle, 'transform' => $transform, 'title' => $title, diff --git a/src/controllers/InstallController.php b/src/controllers/InstallController.php index aaee7268988..6d8043ac5b2 100644 --- a/src/controllers/InstallController.php +++ b/src/controllers/InstallController.php @@ -99,7 +99,7 @@ public function actionIndex(): Response $userIcon = file_get_contents($iconsPath . DIRECTORY_SEPARATOR . 'user.svg'); $worldIcon = file_get_contents($iconsPath . DIRECTORY_SEPARATOR . 'world.svg'); - return $this->renderTemplate('_special/install', compact( + return $this->renderTemplate('_special/install/index.twig', compact( 'showDbScreen', 'license', 'defaultSystemName', diff --git a/src/controllers/PluginStoreController.php b/src/controllers/PluginStoreController.php index 40331c348bd..8a00fac76a9 100644 --- a/src/controllers/PluginStoreController.php +++ b/src/controllers/PluginStoreController.php @@ -79,7 +79,7 @@ public function actionIndex(): Response $view->registerAssetBundle(PluginStoreAsset::class); - return $this->renderTemplate('plugin-store/_index'); + return $this->renderTemplate('plugin-store/_index.twig'); } /** @@ -170,7 +170,7 @@ public function actionCallback(): Response $this->getView()->registerJs('new Craft.PluginStoreOauthCallback(' . Json::encode($options) . ');'); - return $this->renderTemplate('plugin-store/_special/oauth/callback'); + return $this->renderTemplate('plugin-store/_special/oauth/callback.twig'); } /** @@ -182,7 +182,7 @@ public function actionModalCallback(): Response { $craftIdAccessToken = $this->getCraftIdAccessToken(); - return $this->renderTemplate('plugin-store/_special/oauth/modal-callback', [ + return $this->renderTemplate('plugin-store/_special/oauth/modal-callback.twig', [ 'craftIdAccessToken' => $craftIdAccessToken, ]); } diff --git a/src/controllers/RebrandController.php b/src/controllers/RebrandController.php index cc0e54b4a1c..b3e4c150fa2 100644 --- a/src/controllers/RebrandController.php +++ b/src/controllers/RebrandController.php @@ -84,7 +84,7 @@ public function actionUploadSiteImage(): Response } $imagesService->loadImage($fileDestination)->scaleToFit(300, 300)->saveAs($fileDestination); - $html = $this->getView()->renderTemplate('settings/general/_images/' . $type); + $html = $this->getView()->renderTemplate("settings/general/_images/$type.twig"); return $this->asJson([ 'html' => $html, @@ -107,7 +107,7 @@ public function actionDeleteSiteImage(): ?Response FileHelper::clearDirectory(Craft::$app->getPath()->getRebrandPath() . '/' . $type); - $html = $this->getView()->renderTemplate('settings/general/_images/' . $type); + $html = $this->getView()->renderTemplate("settings/general/_images/$type.twig"); return $this->asJson([ 'html' => $html, diff --git a/src/controllers/SectionsController.php b/src/controllers/SectionsController.php index d302c25e671..94867b8a7f3 100644 --- a/src/controllers/SectionsController.php +++ b/src/controllers/SectionsController.php @@ -52,7 +52,7 @@ public function actionIndex(array $variables = []): Response { $variables['sections'] = Craft::$app->getSections()->getAllSections(); - return $this->renderTemplate('settings/sections/_index', $variables); + return $this->renderTemplate('settings/sections/_index.twig', $variables); } /** @@ -105,7 +105,7 @@ public function actionEditSection(?int $sectionId = null, ?Section $section = nu $this->getView()->registerAssetBundle(EditSectionAsset::class); - return $this->renderTemplate('settings/sections/_edit', $variables); + return $this->renderTemplate('settings/sections/_edit.twig', $variables); } /** @@ -225,7 +225,7 @@ public function actionEntryTypesIndex(int $sectionId): Response $title = Craft::t('app', '{section} Entry Types', ['section' => Craft::t('site', $section->name)]); - return $this->renderTemplate('settings/sections/_entrytypes/index', [ + return $this->renderTemplate('settings/sections/_entrytypes/index.twig', [ 'sectionId' => $sectionId, 'section' => $section, 'title' => $title, @@ -293,7 +293,7 @@ public function actionEditEntryType(int $sectionId, ?int $entryTypeId = null, ?E ], ]; - return $this->renderTemplate('settings/sections/_entrytypes/edit', [ + return $this->renderTemplate('settings/sections/_entrytypes/edit.twig', [ 'sectionId' => $sectionId, 'section' => $section, 'entryTypeId' => $entryTypeId, diff --git a/src/controllers/SitesController.php b/src/controllers/SitesController.php index 66b22ffe9ea..2e726971845 100644 --- a/src/controllers/SitesController.php +++ b/src/controllers/SitesController.php @@ -82,7 +82,7 @@ public function actionSettingsIndex(?int $groupId = null): Response 'Delete {site}', ]); - return $this->renderTemplate('settings/sites/index', compact( + return $this->renderTemplate('settings/sites/index.twig', compact( 'crumbs', 'allGroups', 'group', @@ -278,7 +278,7 @@ public function actionEditSite(?int $siteId = null, ?Site $siteModel = null, ?in ]; } - return $this->renderTemplate('settings/sites/_edit', [ + return $this->renderTemplate('settings/sites/_edit.twig', [ 'brandNewSite' => $brandNewSite, 'title' => $title, 'crumbs' => $crumbs, diff --git a/src/controllers/SystemMessagesController.php b/src/controllers/SystemMessagesController.php index 629f153f9b9..6548e77f10f 100644 --- a/src/controllers/SystemMessagesController.php +++ b/src/controllers/SystemMessagesController.php @@ -54,7 +54,7 @@ public function actionGetMessageModal(): Response $message = Craft::$app->getSystemMessages()->getMessage($key, $language); return $this->asJson([ - 'body' => $this->getView()->renderTemplate('_components/utilities/SystemMessages/message-modal', [ + 'body' => $this->getView()->renderTemplate('_components/utilities/SystemMessages/message-modal.twig', [ 'message' => $message, 'language' => $language, ]), diff --git a/src/controllers/SystemSettingsController.php b/src/controllers/SystemSettingsController.php index 88e61ebe7f3..6b00a5e7dd9 100644 --- a/src/controllers/SystemSettingsController.php +++ b/src/controllers/SystemSettingsController.php @@ -55,7 +55,7 @@ public function actionGeneralSettings(): Response { $this->getView()->registerAssetBundle(GeneralSettingsAsset::class); - return $this->renderTemplate('settings/general/_index', [ + return $this->renderTemplate('settings/general/_index.twig', [ 'system' => Craft::$app->getProjectConfig()->get('system') ?? [], ]); } @@ -147,7 +147,7 @@ public function actionEditEmailSettings(?MailSettings $settings = null, ?Transpo } } - return $this->renderTemplate('settings/email/_index', [ + return $this->renderTemplate('settings/email/_index.twig', [ 'settings' => $settings, 'adapter' => $adapter, 'transportTypeOptions' => $transportTypeOptions, @@ -271,7 +271,7 @@ public function actionEditGlobalSet(?int $globalSetId = null, ?GlobalSet $global ]; // Render the template! - return $this->renderTemplate('settings/globals/_edit', [ + return $this->renderTemplate('settings/globals/_edit.twig', [ 'globalSetId' => $globalSetId, 'globalSet' => $globalSet, 'title' => $title, diff --git a/src/controllers/TagsController.php b/src/controllers/TagsController.php index a3a513712c4..9f442e4e087 100644 --- a/src/controllers/TagsController.php +++ b/src/controllers/TagsController.php @@ -40,7 +40,7 @@ public function actionIndex(): Response $tagGroups = Craft::$app->getTags()->getAllTagGroups(); - return $this->renderTemplate('settings/tags/index', [ + return $this->renderTemplate('settings/tags/index.twig', [ 'tagGroups' => $tagGroups, ]); } @@ -87,7 +87,7 @@ public function actionEditTagGroup(?int $tagGroupId = null, ?TagGroup $tagGroup ], ]; - return $this->renderTemplate('settings/tags/_edit', [ + return $this->renderTemplate('settings/tags/_edit.twig', [ 'tagGroupId' => $tagGroupId, 'tagGroup' => $tagGroup, 'title' => $title, diff --git a/src/controllers/TemplatesController.php b/src/controllers/TemplatesController.php index b848bd5b828..1e21f33aebe 100644 --- a/src/controllers/TemplatesController.php +++ b/src/controllers/TemplatesController.php @@ -130,7 +130,7 @@ public function actionOffline(): Response */ public function actionManualUpdateNotification(): Response { - return $this->renderTemplate('_special/dbupdate'); + return $this->renderTemplate('_special/dbupdate.twig'); } /** @@ -163,7 +163,7 @@ public function actionRequirementsCheck(): ?Response throw new ServerErrorHttpException(Craft::t('app', 'The update can’t be installed :( {message}', ['message' => $message])); } - return $this->renderTemplate('_special/cantrun', [ + return $this->renderTemplate('_special/cantrun.twig', [ 'reqCheck' => $reqCheck, ]); } diff --git a/src/controllers/UsersController.php b/src/controllers/UsersController.php index 019083a9879..8cb1ee1a732 100644 --- a/src/controllers/UsersController.php +++ b/src/controllers/UsersController.php @@ -670,7 +670,7 @@ public function actionVerifyEmail(): Response // Do they have an unverified email? if ($user->unverifiedEmail) { if (!$usersService->verifyEmailForUser($user)) { - return $this->renderTemplate('_special/emailtaken', [ + return $this->renderTemplate('_special/emailtaken.twig', [ 'email' => $user->unverifiedEmail, ]); } @@ -1092,7 +1092,7 @@ public function actionEditUser(mixed $userId = null, ?User $user = null, ?array View::POS_END ); - return $this->renderTemplate('users/_edit', compact( + return $this->renderTemplate('users/_edit.twig', compact( 'user', 'isNewUser', 'statusLabel', @@ -2092,7 +2092,7 @@ private function _renderSetPasswordTemplate(array $variables): Response } // Otherwise go with the control panel’s template - return $this->renderTemplate('setpassword', $variables, View::TEMPLATE_MODE_CP); + return $this->renderTemplate('setpassword.twig', $variables, View::TEMPLATE_MODE_CP); } /** @@ -2496,7 +2496,7 @@ private function _renderPhotoTemplate(User $user): string $templateMode = View::TEMPLATE_MODE_CP; } - return $view->renderTemplate('users/_photo', [ + return $view->renderTemplate('users/_photo.twig', [ 'user' => $user, ], $templateMode); } diff --git a/src/controllers/UtilitiesController.php b/src/controllers/UtilitiesController.php index 4f414d0055c..04787ff2c74 100644 --- a/src/controllers/UtilitiesController.php +++ b/src/controllers/UtilitiesController.php @@ -84,7 +84,7 @@ public function actionShowUtility(string $id): Response $this->getView()->registerAssetBundle(UtilitiesAsset::class); - return $this->renderTemplate('utilities/_index', [ + return $this->renderTemplate('utilities/_index.twig', [ 'id' => $id, 'displayName' => $class::displayName(), 'contentHtml' => $class::contentHtml(), @@ -107,7 +107,7 @@ public function actionGetDeprecationErrorTracesModal(): Response $this->requireAcceptsJson(); $logId = Craft::$app->request->getRequiredParam('logId'); - $html = $this->getView()->renderTemplate('_components/utilities/DeprecationErrors/traces_modal', [ + $html = $this->getView()->renderTemplate('_components/utilities/DeprecationErrors/traces_modal.twig', [ 'log' => Craft::$app->deprecator->getLogById($logId), ]); diff --git a/src/controllers/VolumesController.php b/src/controllers/VolumesController.php index 5f84f3ee4f9..9821098aee8 100644 --- a/src/controllers/VolumesController.php +++ b/src/controllers/VolumesController.php @@ -51,7 +51,7 @@ public function actionVolumeIndex(): Response $variables = []; $variables['volumes'] = Craft::$app->getVolumes()->getAllVolumes(); - return $this->renderTemplate('settings/assets/volumes/_index', $variables); + return $this->renderTemplate('settings/assets/volumes/_index.twig', $variables); } /** @@ -118,7 +118,7 @@ public function actionEditVolume(?int $volumeId = null, ?Volume $volume = null): ->redirectUrl('settings/assets') ->saveShortcutRedirectUrl('settings/assets/volumes/{id}') ->editUrl($volume->id ? "settings/assets/volumes/$volume->id" : null) - ->contentTemplate('settings/assets/volumes/_edit', [ + ->contentTemplate('settings/assets/volumes/_edit.twig', [ 'volumeId' => $volumeId, 'volume' => $volume, 'isNewVolume' => $isNewVolume, diff --git a/src/elements/User.php b/src/elements/User.php index 31e8805483a..7b68b2ded2b 100644 --- a/src/elements/User.php +++ b/src/elements/User.php @@ -1606,7 +1606,7 @@ protected function htmlAttributes(string $context): array protected function metaFieldsHtml(bool $static): string { return implode("\n", [ - Craft::$app->getView()->renderTemplate('users/_accountfields', [ + Craft::$app->getView()->renderTemplate('users/_accountfields.twig', [ 'user' => $this, 'isNewUser' => !$this->id, 'static' => $static, diff --git a/src/elements/actions/SetStatus.php b/src/elements/actions/SetStatus.php index 39d50a9e1c7..a533efc76e9 100644 --- a/src/elements/actions/SetStatus.php +++ b/src/elements/actions/SetStatus.php @@ -65,7 +65,7 @@ public function getTriggerHtml(): ?string })(); JS, [static::class]); - return Craft::$app->getView()->renderTemplate('_components/elementactions/SetStatus/trigger'); + return Craft::$app->getView()->renderTemplate('_components/elementactions/SetStatus/trigger.twig'); } /** diff --git a/src/fieldlayoutelements/BaseField.php b/src/fieldlayoutelements/BaseField.php index ec2772a144a..6680059cb07 100644 --- a/src/fieldlayoutelements/BaseField.php +++ b/src/fieldlayoutelements/BaseField.php @@ -199,7 +199,7 @@ public function hasCustomWidth(): bool */ protected function settingsHtml(): ?string { - return Craft::$app->getView()->renderTemplate('_includes/forms/fld/field-settings', [ + return Craft::$app->getView()->renderTemplate('_includes/forms/fld/field-settings.twig', [ 'field' => $this, 'defaultLabel' => $this->defaultLabel(), 'defaultInstructions' => $this->defaultInstructions(), diff --git a/src/fieldlayoutelements/TextField.php b/src/fieldlayoutelements/TextField.php index c6b356c8924..de366d9e75c 100644 --- a/src/fieldlayoutelements/TextField.php +++ b/src/fieldlayoutelements/TextField.php @@ -122,7 +122,7 @@ public function fields(): array */ protected function inputHtml(?ElementInterface $element = null, bool $static = false): ?string { - return Craft::$app->getView()->renderTemplate('_includes/forms/text', [ + return Craft::$app->getView()->renderTemplate('_includes/forms/text.twig', [ 'type' => $this->type, 'autocomplete' => $this->autocomplete, 'class' => $this->class, diff --git a/src/fieldlayoutelements/TextareaField.php b/src/fieldlayoutelements/TextareaField.php index 3bb3742d724..093d23b3216 100644 --- a/src/fieldlayoutelements/TextareaField.php +++ b/src/fieldlayoutelements/TextareaField.php @@ -88,7 +88,7 @@ public function fields(): array */ protected function inputHtml(?ElementInterface $element = null, bool $static = false): ?string { - return Craft::$app->getView()->renderTemplate('_includes/forms/textarea', [ + return Craft::$app->getView()->renderTemplate('_includes/forms/textarea.twig', [ 'class' => $this->class, 'id' => $this->id(), 'describedBy' => $this->describedBy($element, $static), diff --git a/src/fields/Assets.php b/src/fields/Assets.php index 00d25709331..6f7ba738d49 100644 --- a/src/fields/Assets.php +++ b/src/fields/Assets.php @@ -180,12 +180,12 @@ public static function valueType(): string /** * @inheritdoc */ - protected string $settingsTemplate = '_components/fieldtypes/Assets/settings'; + protected string $settingsTemplate = '_components/fieldtypes/Assets/settings.twig'; /** * @inheritdoc */ - protected string $inputTemplate = '_components/fieldtypes/Assets/input'; + protected string $inputTemplate = '_components/fieldtypes/Assets/input.twig'; /** * @inheritdoc diff --git a/src/fields/BaseRelationField.php b/src/fields/BaseRelationField.php index e529009885b..7ab2f582bc7 100644 --- a/src/fields/BaseRelationField.php +++ b/src/fields/BaseRelationField.php @@ -191,12 +191,12 @@ public static function valueType(): string /** * @var string Template to use for settings rendering */ - protected string $settingsTemplate = '_components/fieldtypes/elementfieldsettings'; + protected string $settingsTemplate = '_components/fieldtypes/elementfieldsettings.twig'; /** * @var string Template to use for field rendering */ - protected string $inputTemplate = '_includes/forms/elementSelect'; + protected string $inputTemplate = '_includes/forms/elementSelect.twig'; /** * @var string|null The JS class that should be initialized for the input diff --git a/src/fields/Categories.php b/src/fields/Categories.php index 659a3ffb96d..23ef95e47cd 100644 --- a/src/fields/Categories.php +++ b/src/fields/Categories.php @@ -82,12 +82,12 @@ public static function valueType(): string /** * @inheritdoc */ - protected string $settingsTemplate = '_components/fieldtypes/Categories/settings'; + protected string $settingsTemplate = '_components/fieldtypes/Categories/settings.twig'; /** * @inheritdoc */ - protected string $inputTemplate = '_components/fieldtypes/Categories/input'; + protected string $inputTemplate = '_components/fieldtypes/Categories/input.twig'; /** * @inheritdoc diff --git a/src/fields/Checkboxes.php b/src/fields/Checkboxes.php index 4a5cd54c736..68465b2a836 100644 --- a/src/fields/Checkboxes.php +++ b/src/fields/Checkboxes.php @@ -59,7 +59,7 @@ protected function inputHtml(mixed $value, ?ElementInterface $element = null): s Craft::$app->getView()->setInitialDeltaValue($this->handle, null); } - return Craft::$app->getView()->renderTemplate('_includes/forms/checkboxGroup', [ + return Craft::$app->getView()->renderTemplate('_includes/forms/checkboxGroup.twig', [ 'describedBy' => $this->describedBy, 'name' => $this->handle, 'values' => $this->encodeValue($value), diff --git a/src/fields/Color.php b/src/fields/Color.php index 8bdf4b20f67..0fa6279a519 100644 --- a/src/fields/Color.php +++ b/src/fields/Color.php @@ -124,7 +124,7 @@ public function getElementValidationRules(): array protected function inputHtml(mixed $value, ?ElementInterface $element = null): string { /** @var ColorData|null $value */ - return Craft::$app->getView()->renderTemplate('_includes/forms/color', [ + return Craft::$app->getView()->renderTemplate('_includes/forms/color.twig', [ 'id' => $this->getInputId(), 'describedBy' => $this->describedBy, 'name' => $this->handle, diff --git a/src/fields/Date.php b/src/fields/Date.php index 85ad3cb79cf..12c92b74668 100644 --- a/src/fields/Date.php +++ b/src/fields/Date.php @@ -215,7 +215,7 @@ public function getSettingsHtml(): ?string 'value' => 'showBoth', ]; - return Craft::$app->getView()->renderTemplate('_components/fieldtypes/Date/settings', [ + return Craft::$app->getView()->renderTemplate('_components/fieldtypes/Date/settings.twig', [ 'options' => $options, 'value' => $dateTimeValue, 'incrementOptions' => $incrementOptions, @@ -267,15 +267,15 @@ protected function inputHtml(mixed $value, ?ElementInterface $element = null): s ]; if ($this->showDate) { - $components[] = $view->renderTemplate('_includes/forms/date', $variables); + $components[] = $view->renderTemplate('_includes/forms/date.twig', $variables); } if ($this->showTime) { - $components[] = $view->renderTemplate('_includes/forms/time', $variables); + $components[] = $view->renderTemplate('_includes/forms/time.twig', $variables); } if ($this->showTimeZone) { - $components[] = $view->renderTemplate('_includes/forms/timeZone', [ + $components[] = $view->renderTemplate('_includes/forms/timeZone.twig', [ 'describedBy' => $this->describedBy, 'name' => "$this->handle[timezone]", 'value' => $timezone, diff --git a/src/fields/Dropdown.php b/src/fields/Dropdown.php index 71b22f33a6f..79acef0329b 100644 --- a/src/fields/Dropdown.php +++ b/src/fields/Dropdown.php @@ -62,7 +62,7 @@ protected function inputHtml(mixed $value, ?ElementInterface $element = null): s } } - return Craft::$app->getView()->renderTemplate('_includes/forms/select', [ + return Craft::$app->getView()->renderTemplate('_includes/forms/select.twig', [ 'id' => $this->getInputId(), 'describedBy' => $this->describedBy, 'name' => $this->handle, diff --git a/src/fields/Email.php b/src/fields/Email.php index 42816a40481..30c2004020b 100644 --- a/src/fields/Email.php +++ b/src/fields/Email.php @@ -102,7 +102,7 @@ public function serializeValue(mixed $value, ElementInterface $element = null): */ protected function inputHtml(mixed $value, ?ElementInterface $element = null): string { - return Craft::$app->getView()->renderTemplate('_includes/forms/text', [ + return Craft::$app->getView()->renderTemplate('_includes/forms/text.twig', [ 'type' => 'email', 'id' => $this->getInputId(), 'describedBy' => $this->describedBy, diff --git a/src/fields/Lightswitch.php b/src/fields/Lightswitch.php index d2a48276ee8..72085a87930 100644 --- a/src/fields/Lightswitch.php +++ b/src/fields/Lightswitch.php @@ -126,7 +126,7 @@ public function getSettingsHtml(): ?string protected function inputHtml(mixed $value, ?ElementInterface $element = null): string { $id = $this->getInputId(); - return Craft::$app->getView()->renderTemplate('_includes/forms/lightswitch', [ + return Craft::$app->getView()->renderTemplate('_includes/forms/lightswitch.twig', [ 'id' => $id, 'labelId' => $this->getLabelId(), 'describedBy' => $this->describedBy, diff --git a/src/fields/Matrix.php b/src/fields/Matrix.php index 3522133392a..793109eb832 100644 --- a/src/fields/Matrix.php +++ b/src/fields/Matrix.php @@ -480,7 +480,7 @@ public function getSettingsHtml(): ?string } } - return $view->renderTemplate('_components/fieldtypes/Matrix/settings', + return $view->renderTemplate('_components/fieldtypes/Matrix/settings.twig', [ 'matrixField' => $this, 'fieldTypes' => $fieldTypeOptions, @@ -735,7 +735,7 @@ protected function inputHtml(mixed $value, ?ElementInterface $element = null): s $view->registerJs($js); - return $view->renderTemplate('_components/fieldtypes/Matrix/input', + return $view->renderTemplate('_components/fieldtypes/Matrix/input.twig', [ 'id' => $id, 'name' => $this->handle, @@ -863,7 +863,7 @@ public function getStaticHtml(mixed $value, ElementInterface $element): string $id = StringHelper::randomString(); - return Craft::$app->getView()->renderTemplate('_components/fieldtypes/Matrix/input', [ + return Craft::$app->getView()->renderTemplate('_components/fieldtypes/Matrix/input.twig', [ 'id' => $id, 'name' => $id, 'blockTypes' => $this->getBlockTypes(), diff --git a/src/fields/Money.php b/src/fields/Money.php index 7047d8b92d3..187c7c1f7ae 100644 --- a/src/fields/Money.php +++ b/src/fields/Money.php @@ -143,7 +143,7 @@ public function getSettingsHtml(): ?string } } - return Craft::$app->getView()->renderTemplate('_components/fieldtypes/Money/settings', [ + return Craft::$app->getView()->renderTemplate('_components/fieldtypes/Money/settings.twig', [ 'field' => $this, 'currencies' => $this->_isoCurrencies, 'subUnits' => $this->_isoCurrencies->subunitFor(new Currency($this->currency)), @@ -298,7 +298,7 @@ protected function inputHtml(mixed $value, ?ElementInterface $element = null): s 'currencySymbol' => Craft::$app->getFormattingLocale()->getCurrencySymbol($this->currency), ]); - return $view->renderTemplate('_components/fieldtypes/Money/input', [ + return $view->renderTemplate('_components/fieldtypes/Money/input.twig', [ 'id' => $id, 'currency' => $this->currency, 'currencyLabel' => $currencyLabel, diff --git a/src/fields/MultiSelect.php b/src/fields/MultiSelect.php index e135b58d4d3..b2a90c1197f 100644 --- a/src/fields/MultiSelect.php +++ b/src/fields/MultiSelect.php @@ -56,7 +56,7 @@ protected function inputHtml(mixed $value, ?ElementInterface $element = null): s Craft::$app->getView()->setInitialDeltaValue($this->handle, null); } - return Craft::$app->getView()->renderTemplate('_includes/forms/multiselect', [ + return Craft::$app->getView()->renderTemplate('_includes/forms/multiselect.twig', [ 'id' => $this->getInputId(), 'describedBy' => $this->describedBy, 'name' => $this->handle, diff --git a/src/fields/Number.php b/src/fields/Number.php index 1d346381668..d2802d41057 100644 --- a/src/fields/Number.php +++ b/src/fields/Number.php @@ -157,7 +157,7 @@ protected function defineRules(): array */ public function getSettingsHtml(): ?string { - return Craft::$app->getView()->renderTemplate('_components/fieldtypes/Number/settings', + return Craft::$app->getView()->renderTemplate('_components/fieldtypes/Number/settings.twig', [ 'field' => $this, ]); @@ -281,7 +281,7 @@ protected function inputHtml(mixed $value, ?ElementInterface $element = null): s $view->registerJs($js); - return Craft::$app->getView()->renderTemplate('_components/fieldtypes/Number/input', [ + return Craft::$app->getView()->renderTemplate('_components/fieldtypes/Number/input.twig', [ 'id' => $id, 'describedBy' => $this->describedBy, 'field' => $this, diff --git a/src/fields/PlainText.php b/src/fields/PlainText.php index 73233604dd2..a9e84734ca8 100644 --- a/src/fields/PlainText.php +++ b/src/fields/PlainText.php @@ -166,7 +166,7 @@ public function validateFieldLimit(string $attribute): void */ public function getSettingsHtml(): ?string { - return Craft::$app->getView()->renderTemplate('_components/fieldtypes/PlainText/settings', + return Craft::$app->getView()->renderTemplate('_components/fieldtypes/PlainText/settings.twig', [ 'field' => $this, ]); @@ -210,7 +210,7 @@ public function normalizeValue(mixed $value, ?ElementInterface $element = null): */ protected function inputHtml(mixed $value, ?ElementInterface $element = null): string { - return Craft::$app->getView()->renderTemplate('_components/fieldtypes/PlainText/input', [ + return Craft::$app->getView()->renderTemplate('_components/fieldtypes/PlainText/input.twig', [ 'name' => $this->handle, 'value' => $value, 'field' => $this, diff --git a/src/fields/RadioButtons.php b/src/fields/RadioButtons.php index 4a3cf3aa58e..5d7f6553973 100644 --- a/src/fields/RadioButtons.php +++ b/src/fields/RadioButtons.php @@ -54,7 +54,7 @@ protected function inputHtml(mixed $value, ?ElementInterface $element = null): s Craft::$app->getView()->setInitialDeltaValue($this->handle, null); } - return Craft::$app->getView()->renderTemplate('_includes/forms/radioGroup', [ + return Craft::$app->getView()->renderTemplate('_includes/forms/radioGroup.twig', [ 'describedBy' => $this->describedBy, 'name' => $this->handle, 'value' => $this->encodeValue($value), diff --git a/src/fields/Table.php b/src/fields/Table.php index de48c36a2a4..47be4698575 100644 --- a/src/fields/Table.php +++ b/src/fields/Table.php @@ -319,7 +319,7 @@ public function getSettingsHtml(): ?string Json::encode($dropdownSettingsCols, JSON_UNESCAPED_UNICODE) . ');'); - $columnsField = $view->renderTemplate('_components/fieldtypes/Table/columntable', [ + $columnsField = $view->renderTemplate('_components/fieldtypes/Table/columntable.twig', [ 'cols' => $columnSettings, 'rows' => $this->columns, 'errors' => $this->getErrors('columns'), @@ -338,7 +338,7 @@ public function getSettingsHtml(): ?string 'initJs' => false, ]); - return $view->renderTemplate('_components/fieldtypes/Table/settings', [ + return $view->renderTemplate('_components/fieldtypes/Table/settings.twig', [ 'field' => $this, 'columnsField' => $columnsField, 'defaultsField' => $defaultsField, @@ -653,7 +653,7 @@ private function _getInputHtml(mixed $value, ?ElementInterface $element, bool $s } } - return Craft::$app->getView()->renderTemplate('_includes/forms/editableTable', [ + return Craft::$app->getView()->renderTemplate('_includes/forms/editableTable.twig', [ 'id' => $this->getInputId(), 'name' => $this->handle, 'cols' => $this->columns, diff --git a/src/fields/Tags.php b/src/fields/Tags.php index 25b4da44444..fa259edcc79 100644 --- a/src/fields/Tags.php +++ b/src/fields/Tags.php @@ -98,7 +98,7 @@ protected function inputHtml(mixed $value, ?ElementInterface $element = null): s $tagGroup = $this->_getTagGroup(); if ($tagGroup) { - return Craft::$app->getView()->renderTemplate('_components/fieldtypes/Tags/input', + return Craft::$app->getView()->renderTemplate('_components/fieldtypes/Tags/input.twig', [ 'elementType' => static::elementType(), 'id' => $this->getInputId(), diff --git a/src/fields/Time.php b/src/fields/Time.php index fc5d17a2520..8a7eaedd967 100644 --- a/src/fields/Time.php +++ b/src/fields/Time.php @@ -116,7 +116,7 @@ public function getSettingsHtml(): ?string $incrementOptions = [5, 10, 15, 30, 60]; $incrementOptions = array_combine($incrementOptions, $incrementOptions); - return Craft::$app->getView()->renderTemplate('_components/fieldtypes/Time/settings', [ + return Craft::$app->getView()->renderTemplate('_components/fieldtypes/Time/settings.twig', [ 'incrementOptions' => $incrementOptions, 'field' => $this, 'min' => $this->min ? DateTimeHelper::toDateTime(['time' => $this->min], true) : null, @@ -137,7 +137,7 @@ public function getInputId(): string */ protected function inputHtml(mixed $value, ?ElementInterface $element = null): string { - return Craft::$app->getView()->renderTemplate('_includes/forms/time', [ + return Craft::$app->getView()->renderTemplate('_includes/forms/time.twig', [ 'id' => parent::getInputId(), // can't use $this->getInputId() here because the template adds the "-time" 'describedBy' => $this->describedBy, 'name' => $this->handle, diff --git a/src/fields/Url.php b/src/fields/Url.php index 7aeaca66531..e43eb036981 100644 --- a/src/fields/Url.php +++ b/src/fields/Url.php @@ -233,7 +233,7 @@ protected function inputHtml(mixed $value, ?ElementInterface $element = null): s } } - $input = Craft::$app->getView()->renderTemplate('_includes/forms/text', [ + $input = Craft::$app->getView()->renderTemplate('_includes/forms/text.twig', [ 'id' => $id, 'describedBy' => $this->describedBy, 'class' => ['flex-grow', 'fullwidth'], diff --git a/src/fs/Local.php b/src/fs/Local.php index adeac618570..d0b59945b63 100644 --- a/src/fs/Local.php +++ b/src/fs/Local.php @@ -114,7 +114,7 @@ protected function defineRules(): array */ public function getSettingsHtml(): ?string { - return Craft::$app->getView()->renderTemplate('_components/fs/Local/settings', + return Craft::$app->getView()->renderTemplate('_components/fs/Local/settings.twig', [ 'volume' => $this, ]); diff --git a/src/helpers/Cp.php b/src/helpers/Cp.php index 89baaffa331..55bf69f45cd 100644 --- a/src/helpers/Cp.php +++ b/src/helpers/Cp.php @@ -684,7 +684,7 @@ public static function fieldHtml(string $input, array $config = []): string ($showAttribute ? Html::tag('div', '', [ 'class' => ['flex-grow'], - ]) . static::renderTemplate('_includes/forms/copytextbtn', [ + ]) . static::renderTemplate('_includes/forms/copytextbtn.twig', [ 'id' => "$id-attribute", 'class' => ['code', 'small', 'light'], 'value' => $config['attribute'], @@ -709,7 +709,7 @@ public static function fieldHtml(string $input, array $config = []): string self::_noticeHtml($tipId, 'notice', Craft::t('app', 'Tip:'), $tip) . self::_noticeHtml($warningId, 'warning', Craft::t('app', 'Warning:'), $warning) . ($errors - ? static::renderTemplate('_includes/forms/errorList', [ + ? static::renderTemplate('_includes/forms/errorList.twig', [ 'id' => $errorsId, 'errors' => $errors, ]) @@ -772,7 +772,7 @@ public static function checkboxFieldHtml(array $config): string // Don't pass along `label` since it's ambiguous unset($config['label']); - return static::fieldHtml('template:_includes/forms/checkbox', $config); + return static::fieldHtml('template:_includes/forms/checkbox.twig', $config); } /** @@ -787,7 +787,7 @@ public static function checkboxSelectFieldHtml(array $config): string { $config['id'] = $config['id'] ?? 'checkboxselect' . mt_rand(); $config['fieldset'] = true; - return static::fieldHtml('template:_includes/forms/checkboxSelect', $config); + return static::fieldHtml('template:_includes/forms/checkboxSelect.twig', $config); } /** @@ -802,7 +802,7 @@ public static function colorFieldHtml(array $config): string { $config['id'] = $config['id'] ?? 'color' . mt_rand(); $config['fieldset'] = true; - return static::fieldHtml('template:_includes/forms/color', $config); + return static::fieldHtml('template:_includes/forms/color.twig', $config); } /** @@ -816,7 +816,7 @@ public static function colorFieldHtml(array $config): string public static function editableTableFieldHtml(array $config): string { $config['id'] = $config['id'] ?? 'editabletable' . mt_rand(); - return static::fieldHtml('template:_includes/forms/editableTable', $config); + return static::fieldHtml('template:_includes/forms/editableTable.twig', $config); } /** @@ -829,7 +829,7 @@ public static function editableTableFieldHtml(array $config): string */ public static function lightswitchHtml(array $config): string { - return static::renderTemplate('_includes/forms/lightswitch', $config); + return static::renderTemplate('_includes/forms/lightswitch.twig', $config); } /** @@ -851,7 +851,7 @@ public static function lightswitchFieldHtml(array $config): string $config['fieldLabel'] = $config['fieldLabel'] ?? $config['label'] ?? null; unset($config['label']); - return static::fieldHtml('template:_includes/forms/lightswitch', $config); + return static::fieldHtml('template:_includes/forms/lightswitch.twig', $config); } /** @@ -863,7 +863,7 @@ public static function lightswitchFieldHtml(array $config): string */ public static function selectHtml(array $config): string { - return static::renderTemplate('_includes/forms/select', $config); + return static::renderTemplate('_includes/forms/select.twig', $config); } /** @@ -877,7 +877,7 @@ public static function selectHtml(array $config): string public static function selectFieldHtml(array $config): string { $config['id'] = $config['id'] ?? 'select' . mt_rand(); - return static::fieldHtml('template:_includes/forms/select', $config); + return static::fieldHtml('template:_includes/forms/select.twig', $config); } /** @@ -889,7 +889,7 @@ public static function selectFieldHtml(array $config): string */ public static function selectizeHtml(array $config): string { - return static::renderTemplate('_includes/forms/selectize', $config); + return static::renderTemplate('_includes/forms/selectize.twig', $config); } /** @@ -903,7 +903,7 @@ public static function selectizeHtml(array $config): string public static function selectizeFieldHtml(array $config): string { $config['id'] = $config['id'] ?? 'selectize' . mt_rand(); - return static::fieldHtml('template:_includes/forms/selectize', $config); + return static::fieldHtml('template:_includes/forms/selectize.twig', $config); } /** @@ -915,7 +915,7 @@ public static function selectizeFieldHtml(array $config): string */ public static function multiSelectHtml(array $config): string { - return static::renderTemplate('_includes/forms/multiselect', $config); + return static::renderTemplate('_includes/forms/multiselect.twig', $config); } /** @@ -929,7 +929,7 @@ public static function multiSelectHtml(array $config): string public static function multiSelectFieldHtml(array $config): string { $config['id'] = $config['id'] ?? 'multiselect' . mt_rand(); - return static::fieldHtml('template:_includes/forms/multiselect', $config); + return static::fieldHtml('template:_includes/forms/multiselect.twig', $config); } /** @@ -942,7 +942,7 @@ public static function multiSelectFieldHtml(array $config): string */ public static function textHtml(array $config): string { - return static::renderTemplate('_includes/forms/text', $config); + return static::renderTemplate('_includes/forms/text.twig', $config); } /** @@ -956,7 +956,7 @@ public static function textHtml(array $config): string public static function textFieldHtml(array $config): string { $config['id'] = $config['id'] ?? 'text' . mt_rand(); - return static::fieldHtml('template:_includes/forms/text', $config); + return static::fieldHtml('template:_includes/forms/text.twig', $config); } /** @@ -969,7 +969,7 @@ public static function textFieldHtml(array $config): string */ public static function textareaHtml(array $config): string { - return static::renderTemplate('_includes/forms/textarea', $config); + return static::renderTemplate('_includes/forms/textarea.twig', $config); } /** @@ -983,7 +983,7 @@ public static function textareaHtml(array $config): string public static function textareaFieldHtml(array $config): string { $config['id'] = $config['id'] ?? 'textarea' . mt_rand(); - return static::fieldHtml('template:_includes/forms/textarea', $config); + return static::fieldHtml('template:_includes/forms/textarea.twig', $config); } /** @@ -996,7 +996,7 @@ public static function textareaFieldHtml(array $config): string */ public static function dateHtml(array $config): string { - return static::renderTemplate('_includes/forms/date', $config); + return static::renderTemplate('_includes/forms/date.twig', $config); } /** @@ -1010,7 +1010,7 @@ public static function dateHtml(array $config): string public static function dateFieldHtml(array $config): string { $config['id'] = $config['id'] ?? 'date' . mt_rand(); - return static::fieldHtml('template:_includes/forms/date', $config); + return static::fieldHtml('template:_includes/forms/date.twig', $config); } /** @@ -1023,7 +1023,7 @@ public static function dateFieldHtml(array $config): string */ public static function timeHtml(array $config): string { - return static::renderTemplate('_includes/forms/time', $config); + return static::renderTemplate('_includes/forms/time.twig', $config); } /** @@ -1037,7 +1037,7 @@ public static function timeHtml(array $config): string public static function timeFieldHtml(array $config): string { $config['id'] = $config['id'] ?? 'time' . mt_rand(); - return static::fieldHtml('template:_includes/forms/time', $config); + return static::fieldHtml('template:_includes/forms/time.twig', $config); } /** @@ -1051,7 +1051,7 @@ public static function timeFieldHtml(array $config): string public static function dateTimeFieldHtml(array $config): string { $config['id'] = $config['id'] ?? 'datetime' . mt_rand(); - return static::fieldHtml('template:_includes/forms/datetime', $config); + return static::fieldHtml('template:_includes/forms/datetime.twig', $config); } /** @@ -1064,7 +1064,7 @@ public static function dateTimeFieldHtml(array $config): string */ public static function elementSelectHtml(array $config): string { - return static::renderTemplate('_includes/forms/elementSelect', $config); + return static::renderTemplate('_includes/forms/elementSelect.twig', $config); } /** @@ -1078,7 +1078,7 @@ public static function elementSelectHtml(array $config): string public static function elementSelectFieldHtml(array $config): string { $config['id'] = $config['id'] ?? 'elementselect' . mt_rand(); - return static::fieldHtml('template:_includes/forms/elementSelect', $config); + return static::fieldHtml('template:_includes/forms/elementSelect.twig', $config); } /** @@ -1115,7 +1115,7 @@ public static function autosuggestFieldHtml(array $config): string } } - return static::fieldHtml('template:_includes/forms/autosuggest', $config); + return static::fieldHtml('template:_includes/forms/autosuggest.twig', $config); } /** diff --git a/src/mail/Mailer.php b/src/mail/Mailer.php index 93d534647ee..d79a3d252b1 100644 --- a/src/mail/Mailer.php +++ b/src/mail/Mailer.php @@ -138,7 +138,7 @@ public function send($message): bool $templateMode = View::TEMPLATE_MODE_SITE; } else { // Default to the _special/email.html template - $template = '_special/email'; + $template = '_special/email.twig'; $templateMode = View::TEMPLATE_MODE_CP; } diff --git a/src/mail/transportadapters/Gmail.php b/src/mail/transportadapters/Gmail.php index bd205f20c39..bf078bf4a03 100644 --- a/src/mail/transportadapters/Gmail.php +++ b/src/mail/transportadapters/Gmail.php @@ -88,7 +88,7 @@ protected function defineRules(): array */ public function getSettingsHtml(): ?string { - return Craft::$app->getView()->renderTemplate('_components/mailertransportadapters/Gmail/settings', [ + return Craft::$app->getView()->renderTemplate('_components/mailertransportadapters/Gmail/settings.twig', [ 'adapter' => $this, ]); } diff --git a/src/mail/transportadapters/Sendmail.php b/src/mail/transportadapters/Sendmail.php index 464fe65d616..2b1e465acbf 100644 --- a/src/mail/transportadapters/Sendmail.php +++ b/src/mail/transportadapters/Sendmail.php @@ -107,7 +107,7 @@ public function getSettingsHtml(): ?string ]; }, $this->_allowedCommands()); - return Craft::$app->getView()->renderTemplate('_components/mailertransportadapters/Sendmail/settings', [ + return Craft::$app->getView()->renderTemplate('_components/mailertransportadapters/Sendmail/settings.twig', [ 'adapter' => $this, 'commandOptions' => $commandOptions, ]); diff --git a/src/mail/transportadapters/Smtp.php b/src/mail/transportadapters/Smtp.php index 9ce03c7326e..41e74668de9 100644 --- a/src/mail/transportadapters/Smtp.php +++ b/src/mail/transportadapters/Smtp.php @@ -138,7 +138,7 @@ protected function defineRules(): array */ public function getSettingsHtml(): ?string { - return Craft::$app->getView()->renderTemplate('_components/mailertransportadapters/Smtp/settings', [ + return Craft::$app->getView()->renderTemplate('_components/mailertransportadapters/Smtp/settings.twig', [ 'adapter' => $this, ]); } diff --git a/src/templates/_components/utilities/Upgrade.html b/src/templates/_components/utilities/Upgrade.twig similarity index 100% rename from src/templates/_components/utilities/Upgrade.html rename to src/templates/_components/utilities/Upgrade.twig diff --git a/src/utilities/AssetIndexes.php b/src/utilities/AssetIndexes.php index 8056952dd38..097fe4c5583 100644 --- a/src/utilities/AssetIndexes.php +++ b/src/utilities/AssetIndexes.php @@ -61,7 +61,7 @@ public static function contentHtml(): string } $view = Craft::$app->getView(); - $checkboxSelectHtml = $view->renderTemplate('_includes/forms/checkboxSelect', [ + $checkboxSelectHtml = $view->renderTemplate('_includes/forms/checkboxSelect.twig', [ 'class' => 'first', 'name' => 'volumes', 'options' => $volumeOptions, @@ -74,7 +74,7 @@ public static function contentHtml(): string $existingIndexingSessions = Craft::$app->getAssetIndexer()->getExistingIndexingSessions(); - return $view->renderTemplate('_components/utilities/AssetIndexes', [ + return $view->renderTemplate('_components/utilities/AssetIndexes.twig', [ 'existingSessions' => $existingIndexingSessions, 'checkboxSelectHtml' => $checkboxSelectHtml, 'dateFormat' => $dateFormat, diff --git a/src/utilities/ClearCaches.php b/src/utilities/ClearCaches.php index 414e76b0273..98ab494de2c 100644 --- a/src/utilities/ClearCaches.php +++ b/src/utilities/ClearCaches.php @@ -106,7 +106,7 @@ public static function contentHtml(): string $view->registerAssetBundle(ClearCachesAsset::class); $view->registerJs('new Craft.ClearCachesUtility(\'clear-caches\');'); - return $view->renderTemplate('_components/utilities/ClearCaches', [ + return $view->renderTemplate('_components/utilities/ClearCaches.twig', [ 'cacheOptions' => $cacheOptions, 'tagOptions' => $tagOptions, ]); diff --git a/src/utilities/DbBackup.php b/src/utilities/DbBackup.php index 257dc20bb82..50bc5494260 100644 --- a/src/utilities/DbBackup.php +++ b/src/utilities/DbBackup.php @@ -53,6 +53,6 @@ public static function contentHtml(): string $view->registerAssetBundle(DbBackupAsset::class); $view->registerJs('new Craft.DbBackupUtility(\'db-backup\');'); - return $view->renderTemplate('_components/utilities/DbBackup'); + return $view->renderTemplate('_components/utilities/DbBackup.twig'); } } diff --git a/src/utilities/DeprecationErrors.php b/src/utilities/DeprecationErrors.php index c023f528260..1456f65bbf2 100644 --- a/src/utilities/DeprecationErrors.php +++ b/src/utilities/DeprecationErrors.php @@ -60,7 +60,7 @@ public static function contentHtml(): string $view->registerAssetBundle(DeprecationErrorsAsset::class); - return $view->renderTemplate('_components/utilities/DeprecationErrors', [ + return $view->renderTemplate('_components/utilities/DeprecationErrors/index.twig', [ 'logs' => Craft::$app->getDeprecator()->getLogs(), ]); } diff --git a/src/utilities/FindAndReplace.php b/src/utilities/FindAndReplace.php index a9348acc3c2..20083d295ab 100644 --- a/src/utilities/FindAndReplace.php +++ b/src/utilities/FindAndReplace.php @@ -53,6 +53,6 @@ public static function contentHtml(): string $view->registerAssetBundle(FindReplaceAsset::class); $view->registerJs('new Craft.FindAndReplaceUtility(\'find-replace\');'); - return $view->renderTemplate('_components/utilities/FindAndReplace'); + return $view->renderTemplate('_components/utilities/FindAndReplace.twig'); } } diff --git a/src/utilities/Migrations.php b/src/utilities/Migrations.php index da16650d6e1..7b9328ee599 100644 --- a/src/utilities/Migrations.php +++ b/src/utilities/Migrations.php @@ -62,7 +62,7 @@ public static function contentHtml(): string $migrationHistory = $migrator->getMigrationHistory(); $newMigrations = $migrator->getNewMigrations(); - return $view->renderTemplate('_components/utilities/Migrations', [ + return $view->renderTemplate('_components/utilities/Migrations.twig', [ 'migrationHistory' => $migrationHistory, 'newMigrations' => $newMigrations, ]); diff --git a/src/utilities/PhpInfo.php b/src/utilities/PhpInfo.php index dc8a068efaa..7de1d71cf6b 100644 --- a/src/utilities/PhpInfo.php +++ b/src/utilities/PhpInfo.php @@ -47,7 +47,7 @@ public static function iconPath(): ?string */ public static function contentHtml(): string { - return Craft::$app->getView()->renderTemplate('_components/utilities/PhpInfo', [ + return Craft::$app->getView()->renderTemplate('_components/utilities/PhpInfo.twig', [ 'phpInfo' => self::_phpInfo(), ]); } diff --git a/src/utilities/ProjectConfig.php b/src/utilities/ProjectConfig.php index c31e648d794..c0f5df3e265 100644 --- a/src/utilities/ProjectConfig.php +++ b/src/utilities/ProjectConfig.php @@ -67,7 +67,7 @@ public static function contentHtml(): string $invert = false; } - return $view->renderTemplate('_components/utilities/ProjectConfig', [ + return $view->renderTemplate('_components/utilities/ProjectConfig.twig', [ 'readOnly' => $projectConfig->readOnly, 'invert' => $invert, 'yamlExists' => $projectConfig->writeYamlAutomatically || $projectConfig->getDoesExternalConfigExist(), diff --git a/src/utilities/QueueManager.php b/src/utilities/QueueManager.php index 0f66d9f7020..aa56b77aa66 100644 --- a/src/utilities/QueueManager.php +++ b/src/utilities/QueueManager.php @@ -49,7 +49,7 @@ public static function iconPath(): ?string */ public static function toolbarHtml(): string { - return Craft::$app->getView()->renderTemplate('_components/utilities/QueueManager/toolbar'); + return Craft::$app->getView()->renderTemplate('_components/utilities/QueueManager/toolbar.twig'); } /** @@ -57,7 +57,7 @@ public static function toolbarHtml(): string */ public static function footerHtml(): string { - return Craft::$app->getView()->renderTemplate('_components/utilities/QueueManager/footer'); + return Craft::$app->getView()->renderTemplate('_components/utilities/QueueManager/footer.twig'); } /** @@ -67,6 +67,6 @@ public static function contentHtml(): string { $view = Craft::$app->getView(); $view->registerAssetBundle(QueueManagerAsset::class); - return $view->renderTemplate('_components/utilities/QueueManager/content'); + return $view->renderTemplate('_components/utilities/QueueManager/content.twig'); } } diff --git a/src/utilities/SystemMessages.php b/src/utilities/SystemMessages.php index e200e80e157..f6929391fa7 100644 --- a/src/utilities/SystemMessages.php +++ b/src/utilities/SystemMessages.php @@ -55,7 +55,7 @@ public static function contentHtml(): string $messages = Craft::$app->getSystemMessages()->getAllMessages(); - return $view->renderTemplate('_components/utilities/SystemMessages', [ + return $view->renderTemplate('_components/utilities/SystemMessages/index.twig', [ 'messages' => $messages, ]); } diff --git a/src/utilities/SystemReport.php b/src/utilities/SystemReport.php index 7bd3cb87d21..4b386be02b9 100644 --- a/src/utilities/SystemReport.php +++ b/src/utilities/SystemReport.php @@ -83,7 +83,7 @@ public static function contentHtml(): string } ksort($aliases); - return Craft::$app->getView()->renderTemplate('_components/utilities/SystemReport', [ + return Craft::$app->getView()->renderTemplate('_components/utilities/SystemReport.twig', [ 'appInfo' => self::_appInfo(), 'plugins' => Craft::$app->getPlugins()->getAllPlugins(), 'modules' => $modules, diff --git a/src/utilities/Updates.php b/src/utilities/Updates.php index 173e33fc9c8..5cb3d186293 100644 --- a/src/utilities/Updates.php +++ b/src/utilities/Updates.php @@ -59,6 +59,6 @@ public static function contentHtml(): string $view = Craft::$app->getView(); $view->registerAssetBundle(UpdatesAsset::class); $view->registerJs('new Craft.UpdatesUtility();'); - return $view->renderTemplate('_components/utilities/Updates'); + return $view->renderTemplate('_components/utilities/Updates.twig'); } } diff --git a/src/utilities/Upgrade.php b/src/utilities/Upgrade.php index 1709cec11df..c2a363234bb 100644 --- a/src/utilities/Upgrade.php +++ b/src/utilities/Upgrade.php @@ -75,6 +75,6 @@ public static function contentHtml(): string [$version, $allPlugins], ]); - return $view->renderTemplate('_components/utilities/Upgrade'); + return $view->renderTemplate('_components/utilities/Upgrade.twig'); } } diff --git a/src/web/CpScreenResponseFormatter.php b/src/web/CpScreenResponseFormatter.php index 08c2094ced1..16d833193ed 100644 --- a/src/web/CpScreenResponseFormatter.php +++ b/src/web/CpScreenResponseFormatter.php @@ -63,7 +63,7 @@ private function _formatJson(\yii\web\Request $request, YiiResponse $response, C $notice = $behavior->notice ? $view->namespaceInputs($behavior->notice, $namespace) : null; - $tabs = count($behavior->tabs) > 1 ? $view->namespaceInputs(fn() => $view->renderTemplate('_includes/tabs', [ + $tabs = count($behavior->tabs) > 1 ? $view->namespaceInputs(fn() => $view->renderTemplate('_includes/tabs.twig', [ 'tabs' => $behavior->tabs, ], View::TEMPLATE_MODE_CP), $namespace) : null; diff --git a/src/web/View.php b/src/web/View.php index 82738824252..f7b02c3e378 100644 --- a/src/web/View.php +++ b/src/web/View.php @@ -1514,7 +1514,7 @@ public function setTemplateMode(string $templateMode): void // Update everything if ($templateMode == self::TEMPLATE_MODE_CP) { $this->setTemplatesPath(Craft::$app->getPath()->getCpTemplatesPath()); - $this->_defaultTemplateExtensions = ['html', 'twig']; + $this->_defaultTemplateExtensions = ['twig', 'html']; $this->_indexTemplateFilenames = ['index']; } else { $this->setTemplatesPath(Craft::$app->getPath()->getSiteTemplatesPath()); diff --git a/src/widgets/CraftSupport.php b/src/widgets/CraftSupport.php index 056b2436a61..3d402ab9997 100644 --- a/src/widgets/CraftSupport.php +++ b/src/widgets/CraftSupport.php @@ -141,7 +141,7 @@ public function getBodyHtml(): ?string // Only show the DB backup option if DB backups haven't been disabled $showBackupOption = (Craft::$app->getConfig()->getGeneral()->backupCommand !== false); - return $view->renderTemplate('_components/widgets/CraftSupport/body', [ + return $view->renderTemplate('_components/widgets/CraftSupport/body.twig', [ 'widget' => $this, 'buoeyIcon' => file_get_contents($iconsDir . '/buoey.svg'), 'bullhornIcon' => file_get_contents($iconsDir . '/bullhorn.svg'), diff --git a/src/widgets/Feed.php b/src/widgets/Feed.php index 838f103da22..4514c061ed0 100644 --- a/src/widgets/Feed.php +++ b/src/widgets/Feed.php @@ -81,7 +81,7 @@ protected function defineRules(): array */ public function getSettingsHtml(): ?string { - return Craft::$app->getView()->renderTemplate('_components/widgets/Feed/settings', + return Craft::$app->getView()->renderTemplate('_components/widgets/Feed/settings.twig', [ 'widget' => $this, ]); @@ -125,7 +125,7 @@ public function getBodyHtml(): ?string ); } - return Craft::$app->getView()->renderTemplate('_components/widgets/Feed/body', [ + return Craft::$app->getView()->renderTemplate('_components/widgets/Feed/body.twig', [ 'feed' => $data, ]); } diff --git a/src/widgets/NewUsers.php b/src/widgets/NewUsers.php index 9f9a19308f9..ed9b639e0a6 100644 --- a/src/widgets/NewUsers.php +++ b/src/widgets/NewUsers.php @@ -95,7 +95,7 @@ public function getBodyHtml(): ?string */ public function getSettingsHtml(): ?string { - return Craft::$app->getView()->renderTemplate('_components/widgets/NewUsers/settings', + return Craft::$app->getView()->renderTemplate('_components/widgets/NewUsers/settings.twig', [ 'widget' => $this, ]); diff --git a/src/widgets/QuickPost.php b/src/widgets/QuickPost.php index 44ed47fa721..db30458e3c9 100644 --- a/src/widgets/QuickPost.php +++ b/src/widgets/QuickPost.php @@ -117,7 +117,7 @@ public function getSettingsHtml(): ?string } } - return Craft::$app->getView()->renderTemplate('_components/widgets/QuickPost/settings', + return Craft::$app->getView()->renderTemplate('_components/widgets/QuickPost/settings.twig', [ 'sections' => $sections, 'fieldsByEntryTypeId' => $fieldsByEntryTypeId, @@ -175,7 +175,7 @@ public function getBodyHtml(): ?string $view->startJsBuffer(); - $html = $view->renderTemplate('_components/widgets/QuickPost/body', + $html = $view->renderTemplate('_components/widgets/QuickPost/body.twig', [ 'section' => $section, 'entryType' => $entryType, diff --git a/src/widgets/RecentEntries.php b/src/widgets/RecentEntries.php index b1524f2b177..95a0c4587d5 100644 --- a/src/widgets/RecentEntries.php +++ b/src/widgets/RecentEntries.php @@ -81,7 +81,7 @@ protected function defineRules(): array */ public function getSettingsHtml(): ?string { - return Craft::$app->getView()->renderTemplate('_components/widgets/RecentEntries/settings', + return Craft::$app->getView()->renderTemplate('_components/widgets/RecentEntries/settings.twig', [ 'widget' => $this, ]); @@ -143,7 +143,7 @@ public function getBodyHtml(): ?string $entries = $this->_getEntries(); - return $view->renderTemplate('_components/widgets/RecentEntries/body', + return $view->renderTemplate('_components/widgets/RecentEntries/body.twig', [ 'entries' => $entries, ]); diff --git a/src/widgets/Updates.php b/src/widgets/Updates.php index 7435f545ad0..7acc2a478cb 100644 --- a/src/widgets/Updates.php +++ b/src/widgets/Updates.php @@ -71,7 +71,7 @@ public function getBodyHtml(): ?string } if ($cached) { - return $view->renderTemplate('_components/widgets/Updates/body', + return $view->renderTemplate('_components/widgets/Updates/body.twig', [ 'total' => Craft::$app->getUpdates()->getTotalAvailableUpdates(), ]); diff --git a/tests/unit/web/ControllerTest.php b/tests/unit/web/ControllerTest.php index 2bc43e1eb62..424f29a7235 100644 --- a/tests/unit/web/ControllerTest.php +++ b/tests/unit/web/ControllerTest.php @@ -64,7 +64,7 @@ public function testTemplateRendering(): void // We need to render a template from the site dir. Craft::$app->getView()->setTemplateMode(View::TEMPLATE_MODE_SITE); - $response = $this->controller->renderTemplate('template'); + $response = $this->controller->renderTemplate('template.twig'); (new TemplateResponseFormatter())->format($response); // Again. If this is all good. We can expect Yii to do its thing. @@ -84,7 +84,7 @@ public function testTemplateRenderingIfHeadersAlreadySet(): void Craft::$app->getView()->setTemplateMode(View::TEMPLATE_MODE_SITE); Craft::$app->getResponse()->getHeaders()->set('content-type', 'HEADERS'); - $response = $this->controller->renderTemplate('template'); + $response = $this->controller->renderTemplate('template.twig'); (new TemplateResponseFormatter())->format($response); // Again. If this is all good. We can expect Yii to do its thing. diff --git a/tests/unit/web/ViewTest.php b/tests/unit/web/ViewTest.php index 60f17be9fef..a07c9d29e68 100644 --- a/tests/unit/web/ViewTest.php +++ b/tests/unit/web/ViewTest.php @@ -149,13 +149,13 @@ public function testRenderTemplate(): void // Assert that the _renderingTemplate prop goes in and comes out as null. self::assertNull($this->getInaccessibleProperty($this->view, '_renderingTemplate')); - $result = $this->view->renderTemplate('withvar', ['name' => 'Giel Tettelaar']); + $result = $this->view->renderTemplate('withvar.twig', ['name' => 'Giel Tettelaar']); self::assertSame($result, 'Hello iam Giel Tettelaar'); self::assertNull($this->getInaccessibleProperty($this->view, '_renderingTemplate')); // Test that templates can work without variables. - $result = $this->view->renderTemplate('novar'); + $result = $this->view->renderTemplate('novar.twig'); self::assertSame($result, 'I have no vars'); } @@ -219,7 +219,7 @@ public function testSetCpTemplateMode(): void ); self::assertSame( - ['html', 'twig'], + ['twig', 'html'], $this->getInaccessibleProperty($this->view, '_defaultTemplateExtensions') );