Unable to add content to a content type named 'type'

Created on 3 July 2019, over 5 years ago
Updated 12 September 2024, 3 months ago

Problem/Motivation

The form hooks for entity type and bundles can cause a naming collision if the bundle is named 'type'.

Example:

After installing a new Drupal 8.8.x, I created a content type with the machine name type
When I tried to add content to the above content type I received WSOD.

In the error log, this is the message

Error: Call to undefined method Drupal\node\Entity\Node::getThirdPartySetting() in menu_ui_form_node_type_form_alter() (line 376 of /srv/bindings/3bbcd18b06c44304aea5aca03069c666/code/web/core/modules/menu_ui/menu_ui.module) #0 /srv/bindings/3bbcd18b06c44304aea5aca03069c666/code/web/core/lib/Drupal/Core/Extension/ModuleHandler.php(539): menu_ui_form_node_type_form_alter(Array, Object(Drupal\Core\Form\FormState), 'node_type_form') #1 /srv/bindings/3bbcd18b06c44304aea5aca03069c666/code/web/core/lib/Drupal/Core/Form/FormBuilder.php(835): Drupal\Core\Extension\ModuleHandler->alter('form', Array, Object(Drupal\Core\Form\FormState), 'node_type_form') #2 /srv/bindings/3bbcd18b06c44304aea5aca03069c666/code/web/modules/contrib/devel/webprofiler/src/Form/FormBuilderWrapper.php(29): Drupal\Core\Form\FormBuilder->prepareForm('node_type_form', Array, Object(Drupal\Core\Form\FormState)) #3 /srv/bindings/3bbcd18b06c44304aea5aca03069c666/code/web/core/lib/Drupal/Core/Form/FormBuilder.php(277): Drupal\webprofiler\Form\FormBuilderWrapper->prepareForm('node_type_form', Array, Object(Drupal\Core\Form\FormState)) #4 /srv/bindings/3bbcd18b06c44304aea5aca03069c666/code/web/core/lib/Drupal/Core/Entity/EntityFormBuilder.php(61): Drupal\Core\Form\FormBuilder->buildForm('node_type_form', Object(Drupal\Core\Form\FormState)) #5 /srv/bindings/3bbcd18b06c44304aea5aca03069c666/code/web/core/modules/node/src/Controller/NodeController.php(129): Drupal\Core\Entity\EntityFormBuilder->getForm(Object(Drupal\node\Entity\Node)) #6 [internal function]: Drupal\node\Controller\NodeController->add(Object(Drupal\node\Entity\NodeType)) #7 /srv/bindings/3bbcd18b06c44304aea5aca03069c666/code/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array(Array, Array) #8 /srv/bindings/3bbcd18b06c44304aea5aca03069c666/code/web/core/lib/Drupal/Core/Render/Renderer.php(582): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() #9 /srv/bindings/3bbcd18b06c44304aea5aca03069c666/code/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(124): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure)) #10 /srv/bindings/3bbcd18b06c44304aea5aca03069c666/code/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) #11 /srv/bindings/3bbcd18b06c44304aea5aca03069c666/code/vendor/symfony/http-kernel/HttpKernel.php(151): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() #12 /srv/bindings/3bbcd18b06c44304aea5aca03069c666/code/vendor/symfony/http-kernel/HttpKernel.php(68): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1) #13 /srv/bindings/3bbcd18b06c44304aea5aca03069c666/code/web/core/lib/Drupal/Core/StackMiddleware/Session.php(57): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #14 /srv/bindings/3bbcd18b06c44304aea5aca03069c666/code/web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(47): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #15 /srv/bindings/3bbcd18b06c44304aea5aca03069c666/code/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(106): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #16 /srv/bindings/3bbcd18b06c44304aea5aca03069c666/code/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass(Object(Symfony\Component\HttpFoundation\Request), 1, true) #17 /srv/bindings/3bbcd18b06c44304aea5aca03069c666/code/web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(47): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #18 /srv/bindings/3bbcd18b06c44304aea5aca03069c666/code/web/modules/contrib/devel/webprofiler/src/StackMiddleware/WebprofilerMiddleware.php(38): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #19 /srv/bindings/3bbcd18b06c44304aea5aca03069c666/code/web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(52): Drupal\webprofiler\StackMiddleware\WebprofilerMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #20 /srv/bindings/3bbcd18b06c44304aea5aca03069c666/code/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #21 /srv/bindings/3bbcd18b06c44304aea5aca03069c666/code/web/core/lib/Drupal/Core/DrupalKernel.php(693): Stack\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #22 /srv/bindings/3bbcd18b06c44304aea5aca03069c666/code/web/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request)) #23 {main}.

Proposed resolution

Steps to replicate

  1. Install a new Drupal 8.8.x
  2. Create content type with machine name type
  3. Create new content of the content type type

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

🐛 Bug report
Status

Active

Version

11.0 🔥

Component
Entity 

Last updated about 13 hours ago

Created by

🇺🇸United States sjshaal Boca Raton, FL

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024