Error message
Warning: filemtime(): stat failed for sites/default/files/php/twig/6afadaf30eef4_views-view.html.twig_LYlr82ZEwzwdklNuXVPebYtKI in Drupal\Component\PhpStorage\MTimeProtectedFastFileStorage->getFullPath() (line 133 of core/lib/Drupal/Component/PhpStorage/MTimeProtectedFastFileStorage.php).
Drupal\Component\PhpStorage\MTimeProtectedFastFileStorage->getFullPath() (Line: 62)
Drupal\Component\PhpStorage\MTimeProtectedFileStorage->checkFile() (Line: 38)
Drupal\Component\PhpStorage\MTimeProtectedFileStorage->load() (Line: 109)
Drupal\Core\Template\TwigPhpStorageCache->load() (Line: 417)
Twig\Environment->loadTemplate() (Line: 384)
Twig\Environment->load() (Line: 35)
Drupal\Core\Template\TwigThemeEngine->renderTemplate() (Line: 428)
Drupal\Core\Theme\ThemeManager->render() (Line: 504)
Drupal\Core\Render\Renderer->doRender() (Line: 517)
Drupal\Core\Render\Renderer->doRender() (Line: 230)
Drupal\Core\Render\Renderer->render() (Line: 627)
Drupal\Core\Template\TwigExtension->renderVar() (Line: 151)
__TwigTemplate_bab16189a5f7d75d617e4595832c5fa1->doDisplay() (Line: 461)
Twig\Template->yield() (Line: 444)
Twig\Template->render() (Line: 53)
Twig\TemplateWrapper->render() (Line: 35)
Drupal\Core\Template\TwigThemeEngine->renderTemplate() (Line: 428)
Drupal\Core\Theme\ThemeManager->render() (Line: 504)
Drupal\Core\Render\Renderer->doRender() (Line: 230)
Drupal\Core\Render\Renderer->render() (Line: 242)
Drupal\Core\Render\MainContent\HtmlRenderer->{closure:Drupal\Core\Render\MainContent\HtmlRenderer::prepare():235}() (Line: 638)
Drupal\Core\Render\Renderer::{closure:Drupal\Core\Render\Renderer::executeInRenderContext():638}()
Fiber->resume() (Line: 653)
Drupal\Core\Render\Renderer->executeInRenderContext() (Line: 235)
Drupal\Core\Render\MainContent\HtmlRenderer->prepare() (Line: 131)
Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse() (Line: 69)
Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray() (Line: 254)
Symfony\Component\EventDispatcher\EventDispatcher::{closure:Symfony\Component\EventDispatcher\EventDispatcher::optimizeListeners():249}() (Line: 206)
Symfony\Component\EventDispatcher\EventDispatcher->callListeners() (Line: 56)
Symfony\Component\EventDispatcher\EventDispatcher->dispatch() (Line: 200)
Symfony\Component\HttpKernel\HttpKernel->handleRaw() (Line: 77)
Symfony\Component\HttpKernel\HttpKernel->handle() (Line: 53)
Drupal\Core\StackMiddleware\Session->handle() (Line: 30)
Drupal\Core\StackMiddleware\KernelPreHandle->handle() (Line: 28)
Drupal\Core\StackMiddleware\ContentLength->handle() (Line: 32)
Drupal\big_pipe\StackMiddleware\ContentLength->handle() (Line: 203)
Drupal\page_cache\StackMiddleware\PageCache->fetch() (Line: 140)
Drupal\page_cache\StackMiddleware\PageCache->lookup() (Line: 89)
Drupal\page_cache\StackMiddleware\PageCache->handle() (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle() (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle() (Line: 71)
Drupal\Core\StackMiddleware\AjaxPageState->handle() (Line: 54)
Drupal\Core\StackMiddleware\StackedHttpKernel->handle() (Line: 753)
Drupal\Core\DrupalKernel->handle() (Line: 34)
Symfony\Component\Runtime\Runner\Symfony\HttpKernelRunner->run() (Line: 32)
require() (Line: 22)
require_once() (Line: 13)
- You are browsing documentation for drupal 9.5.x, which is not supported anymore. Read the updated version of this page for drupal 11.x (the latest version).
function CommentManager::addBodyField
Same name and namespace in other branches
- 10 core/modules/comment/src/CommentManager.php \Drupal\comment\CommentManager::addBodyField()
- 11.x core/modules/comment/src/CommentManager.php \Drupal\comment\CommentManager::addBodyField()
- 8.9.x core/modules/comment/src/CommentManager.php \Drupal\comment\CommentManager::addBodyField()
Creates a comment_body field.
Parameters
string $comment_type:
The comment bundle.
Overrides CommentManagerInterface::addBodyField
File
-
core/modules/comment/src/CommentManager.php, line 121
Class
- CommentManager
- Comment manager contains common functions to manage comment fields.
Namespace
Drupal\comment
Code
public function addBodyField($comment_type_id) {
if (!FieldConfig::loadByName('comment', $comment_type_id, 'comment_body')) {
$field = $this->entityTypeManager
->getStorage('field_config')
->create([
'label' => 'Comment',
'bundle' => $comment_type_id,
'required' => TRUE,
'field_storage' => FieldStorageConfig::loadByName('comment', 'comment_body'),
]);
$field->save();
$this->entityDisplayRepository
->getFormDisplay('comment', $comment_type_id)
->setComponent('comment_body', [
'type' => 'text_textarea',
])
->save();
$this->entityDisplayRepository
->getViewDisplay('comment', $comment_type_id)
->setComponent('comment_body', [
'label' => 'hidden',
'type' => 'text_default',
'weight' => 0,
])
->save();
}
}