Problem/Motivation

When using Field UI to manage fields after enabling, and then disabling title 'Display Configurable Title' for a node type, it throws

Notice: Undefined index: title in Drupal\field_ui\Form\EntityDisplayFormBase->copyFormValuesToEntity() (line 549 of core/modules/field_ui/src/Form/EntityDisplayFormBase.php).
Drupal\field_ui\Form\EntityDisplayFormBase->copyFormValuesToEntity(Object, Array, Object) (Line: 291)
Drupal\Core\Entity\EntityForm->buildEntity(Array, Object) (Line: 179)
Drupal\Core\Entity\EntityForm->afterBuild(Array, Object)
.......

Proposed resolution

Find a way to make 'title' unset its settings it injected into the display modes when the per-entity checkbox was enabled.

Or at least ensure that the form does not expect a value there when it's disabled for a content type.

To replicate

* Ensure development settings (php log errors, show errors to screen) are on.
* Enable field_ui and 'title'
* Edit a node "Title Settings" and turn on "Display Configurable Title"
* Edit a nodes display, eg teaser, and see the configurable 'title' there. Adjust something and SAVE.
* Observe that things work OK.

* Now : Edit the node "Title Settings" and turn off "Display Configurable Title"
* Edit a nodes display, eg teaser, and see the configurable 'title' is no longer there.
* SAVE.
* Observe the above Exception - the form believes the 'title' field should still be there, and is complaining that it was not submitted.
* Save again - error still repeats.

Additional

I had Display Suite on - not sure if that's relevant. Title module seems redundant with DS anyway (I was introducing this late in the build, and trying to remove 'title' for this reason)

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

dman created an issue. See original summary.

magunz’s picture

Assigned: Unassigned » magunz

I am having a look

magunz’s picture

You are right dman following your instructions i've got this nasty red error on my screen

Notice: Undefined index: title in Drupal\field_ui\Form\EntityDisplayFormBase->copyFormValuesToEntity() (line 551 of core/modules/field_ui/src/Form/EntityDisplayFormBase.php).
Drupal\field_ui\Form\EntityDisplayFormBase->copyFormValuesToEntity(Object, Array, Object) (Line: 291)
Drupal\Core\Entity\EntityForm->buildEntity(Array, Object) (Line: 179)
Drupal\Core\Entity\EntityForm->afterBuild(Array, Object)
call_user_func_array(Array, Array) (Line: 1050)
Drupal\Core\Form\FormBuilder->doBuildForm('entity_view_display_edit_form', Array, Object) (Line: 555)
Drupal\Core\Form\FormBuilder->processForm('entity_view_display_edit_form', Array, Object) (Line: 314)
Drupal\Core\Form\FormBuilder->buildForm('entity_view_display_edit_form', Object) (Line: 74)
Drupal\Core\Controller\FormController->getContentResult(Object, Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 574)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
call_user_func_array(Object, Array) (Line: 139)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 62)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 99)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 78)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 50)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 652)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
Notice: Undefined index: title in Drupal\field_ui\Form\EntityDisplayFormBase->copyFormValuesToEntity() (line 551 of core/modules/field_ui/src/Form/EntityDisplayFormBase.php).
Drupal\field_ui\Form\EntityDisplayFormBase->copyFormValuesToEntity(Object, Array, Object) (Line: 291)
Drupal\Core\Entity\EntityForm->buildEntity(Array, Object) (Line: 276)
Drupal\Core\Entity\EntityForm->submitForm(Array, Object) (Line: 506)
Drupal\field_ui\Form\EntityDisplayFormBase->submitForm(Array, Object)
call_user_func_array(Array, Array) (Line: 111)
Drupal\Core\Form\FormSubmitter->executeSubmitHandlers(Array, Object) (Line: 51)
Drupal\Core\Form\FormSubmitter->doSubmitForm(Array, Object) (Line: 583)
Drupal\Core\Form\FormBuilder->processForm('entity_view_display_edit_form', Array, Object) (Line: 314)
Drupal\Core\Form\FormBuilder->buildForm('entity_view_display_edit_form', Object) (Line: 74)
Drupal\Core\Controller\FormController->getContentResult(Object, Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 574)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
call_user_func_array(Object, Array) (Line: 139)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 62)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 99)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 78)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 50)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 652)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

let me see how to delete/reset the configurations once disabled "Display Configurable Title" for that entity

spesic’s picture

Confirming that this error happens on all content types when trying to configure node display if "Display Configurable Title" is not checked (even if it wasn't checked before)

Sam152’s picture

The branch should be unsupported. Big changes to titles in general happened after this was built and as dman points out, DS solves the problem better than title does.

Derimagia’s picture

In case this is ever worked on, the issue stems from title_form_entity_view_display_edit_form_alter - the title FAPI element is unset (!!!!) instead of hidden with '#access'. Agreed that Display Suite is better for this, especially in this state.

imclean’s picture

Status: Active » Needs review
FileSize
457 bytes

Thanks @Derimagia. This resolves the issue.

imclean’s picture

Status: Needs review » Needs work

Tests need to be updated as the title field will still exist.

AdamPS’s picture

Assigned: magunz » Unassigned