The Needs Review Queue Bot → tested this issue. It either no longer applies to Drupal core, or fails the Drupal core commit checks. Therefore, this issue status is now "Needs work".
Apart from a re-roll or rebase, this issue may need more work to address feedback in the issue or MR comments. To progress an issue, incorporate this feedback as part of the process of updating the issue. This helps other contributors to know what is outstanding.
Consult the Drupal Contributor Guide → to find step-by-step guides for working with issues.
Hi,
Since not able to create the branch for the latest version Drupal 11.x.So Attaching the rerolled patch file for the core version 11.x.
- 🇺🇸United States TolstoyDotCom L.A.
[Copying from the since closed "Hiding the node title makes node form submission crash 🐛 Hiding the node title makes node form submission crash Active "]
It seems to me that everything should have a title, even in the case of a "Person" object. The title could be random, or constructed from something else, but you should always be able to count on an existing entity having a title of some kind just as you can count on it having an ID.
Also, I don't think handling this at the form level would be a good idea since someone might hide the title and then have custom code or a contrib module that provides the title. Preventing them from hiding the title would cause problems for them. If you let them do it but instead show a warning that would annoy people who know what they're doing and confuse others.
I suggest changing SqlContentEntityStorage::mapToStorageRecord to throw an exception if a field is required but empty. It already throws an exception in one case throw new EntityStorageException("Table mapping contains invalid field $field_name."); so adding a check in the same area doesn't seem out of place. You're going to get an exception in any case, it might as well give the user a clue what the problem is.
- 🇨🇴Colombia yasminOrj
Hi,
I tried patch #65 ✨ Do not require a 'title' field Needs work in Drupal 11.x , but it didn’t work for me. I’m sharing the error that appears when I hide the field and try to save a node without a title. - 🇺🇸United States smustgrave
Fixes should be in MRs
Issue summary appears to be missing sections too. Probably could use a title update too as that's very miss leading.
- First commit to issue fork.
- Merge request !10107Issue #2797141 by Driskell, daffie, andypost, Charlie ChX Negyesi,... → (Open) created by arunkumark
- 🇮🇳India arunkumark Coimbatore
arunkumark → changed the visibility of the branch 2358537-do-not-require to hidden.
- 🇮🇳India arunkumark Coimbatore
arunkumark → changed the visibility of the branch 9.4.x to hidden.
- 🇮🇳India supriyak
Hi,
Changed title from 'Do not require a 'title' field' to 'Remove 'not null' constraint from node title field/column.('Title' field present in node entity should not be mandatory.)'.
Thanks!
- Status changed to Postponed: needs info
6 days ago 4:14am 26 May 2025 - 🇦🇺Australia acbramley
I'm not really sure if this is something core should support to be honest.
As expected, when you have a node with a NULL title a LOT of other things break horribly.
Just to name a few in the first few minutes of testing this:
1. You can't save a node because
NodeForm::save
uses the node's title in 2 places: the log context'%title' => $node->label()
, and the t_args with$node->toLink()
(EntityBase::toLink
does not fail gracefully when $text is NULL and$this->label()
returns NULL). Both of these throw fatal errors with a NULL title.2. Once manually fixing the above I get a message
Article has been created.
, that's not very helpful, but at least the view page works.3. The Edit form throws a fatal error because the title is
Edit @type @title
where @title is$node->label()
4. The Revisions page throws a fatal error because the title is
Revisions for %title
5. Deleting a node throws a fatal error because it tries to print a message
The @type %title has been deleted.
And I'm sure there are many, many more examples.
The
label
function has to be able to return NULL because an entity type can have no label defined. There is an argument I suppose that all of these places should account for a NULL label return but given 99% of sites probably don't need this it doesn't seem like it passes the bar to be part of core.Given contrib/custom modules can modify the base field definition to removing the required/not null flags I'm wondering if this should be closed as won't fix?