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)
Comment | File | Size | Author |
---|---|---|---|
#7 | throws_exceptions_in_field_ui-2802725-7.patch | 457 bytes | imclean |
Comments
Comment #2
magunz CreditAttribution: magunz commentedI am having a look
Comment #3
magunz CreditAttribution: magunz commentedYou are right dman following your instructions i've got this nasty red error on my screen
let me see how to delete/reset the configurations once disabled "Display Configurable Title" for that entity
Comment #4
spesic CreditAttribution: spesic commentedConfirming 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)
Comment #5
Sam152 CreditAttribution: Sam152 commentedThe 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.
Comment #6
Derimagia CreditAttribution: Derimagia as a volunteer and at Mindgrub Technologies commentedIn 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.
Comment #7
imclean CreditAttribution: imclean commentedThanks @Derimagia. This resolves the issue.
Comment #8
imclean CreditAttribution: imclean commentedTests need to be updated as the title field will still exist.
Comment #9
AdamPS CreditAttribution: AdamPS at AlbanyWeb commented