Improve error message when attempting to fork an unforkable component.

Fixes #5142 and rainlab/forum-plugin#141
This commit is contained in:
Luke Towers 2020-06-28 10:57:47 -06:00
parent 869625aef2
commit c84c51c820
2 changed files with 6 additions and 0 deletions

View File

@ -403,6 +403,11 @@ class Index extends Controller
$manager = ComponentManager::instance();
$componentObj = $manager->makeComponent($componentName);
$partial = ComponentPartial::load($componentObj, 'default');
if (!$partial) {
throw new ApplicationException(Lang::get('cms::lang.component.no_default_partial'));
}
$content = $partial->getContent();
$content = str_replace('__SELF__', $alias, $content);

View File

@ -249,6 +249,7 @@ return [
'invalid_request' => 'The template cannot be saved because of invalid component data.',
'no_records' => 'No components found',
'not_found' => "The component ':name' is not found.",
'no_default_partial' => "This component does not have a 'default' partial",
'method_not_found' => "The component ':name' does not contain a method ':method'.",
'soft_component' => 'Soft Component',
'soft_component_description' => 'This component is missing but optional.',