{"record":{"id":"0ad603ed777e70dd","repo":"octobercms/october","slug":"component-does-use-a-default-partial","errorCode":null,"errorMessage":"Component does use a default partial","messagePattern":"Component does use a default partial","errorType":"exception","errorClass":"ApplicationException","httpStatus":null,"severity":"error","filePath":"modules/cms/classes/editorextension/HasExtensionCrud.php","lineNumber":208,"sourceCode":"     * command_onExpandCmsComponent\n     */\n    protected function command_onExpandCmsComponent()\n    {\n        if (!$componentAlias = post('componentAlias')) {\n            throw new ApplicationException(trans('cms::lang.component.no_records'));\n        }\n\n        $documentData = $this->getRequestDocumentData();\n        $componentClass = $this->findComponentClassByAlias($componentAlias, $documentData);\n        if (!$componentClass) {\n            throw new ApplicationException(trans('cms::lang.component.not_found', ['name' => $componentAlias]));\n        }\n\n        $manager = ComponentManager::instance();\n        $componentObj = $manager->makeComponent($componentClass);\n        $partial = ComponentPartial::load($componentObj, 'default');\n        if (!$partial) {\n            throw new ApplicationException(__('Component does use a default partial'));\n        }\n\n        $content = $partial->getContent();\n        $content = str_replace('__SELF__', $componentAlias, $content);\n\n        return [\n            'content' => $content\n        ];\n    }\n\n    /**\n     * loadTemplate returns an existing template of a given type\n     * @param string $documentType\n     * @param string $path\n     * @return mixed\n     */\n    private function loadTemplate($documentType, $path)\n    {","sourceCodeStart":190,"sourceCodeEnd":226,"githubUrl":"https://github.com/octobercms/october/blob/b608633a7e8922487d91a8161499020121c3b3bf/modules/cms/classes/editorextension/HasExtensionCrud.php#L190-L226","documentation":"When the editor expands a CMS component it loads the component's partials/default.htm via ComponentPartial::load($component, 'default'); if the component ships no default partial, an ApplicationException is thrown. Note the message 'Component does use a default partial' is a wording bug — it means the component does NOT use (provide) a default partial.","triggerScenarios":"Clicking the expand/insert action in the CMS editor for a component that renders via its own onRender() logic or custom partial names instead of partials/default.htm.","commonSituations":"Third-party or custom components written without a default.htm; components that only define other partials (e.g. 'list.htm'); new component development where the partials folder was never created.","solutions":["Create partials/default.htm in the component directory (plugins/<plugin>/components/<component>/partials/default.htm)","If another partial should act as the default, rename/copy it to default.htm or add a thin default.htm that includes it","For components that render entirely in PHP, avoid the editor's expand action"],"exampleFix":"// new file: plugins/myplugin/components/alert/partials/default.htm\n<div class=\"alert\" data-flash-message>{{ __SELF__.message }}</div>","handlingStrategy":"validation","validationCode":"$componentObj = $manager->makeComponent($class);\nif (!$componentObj || !\\Cms\\Classes\\ComponentPartial::load($componentObj, 'default')) {\n    // no default partial: hide the expand action or offer a different partial\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always ship a partials/default.htm with CMS components meant for the editor","If a component has no default markup, disable its expand/insert affordance in the UI","Cover 'expand in editor' in component tests, not just front-end rendering"],"tags":["editor","component","partials","cms","backend"],"backgroundTag":"missing-default-template","analyzedSha":"b608633a7e8922487d91a8161499020121c3b3bf","analyzedAt":"2026-08-21T04:24:57.515Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}