Book allows emptying node titles in admin/content/book/* (Notice: Trying to get property of non-object in node_page_title)
>>> [!note] Migrated issue <!-- Drupal.org comment --> <!-- Migrated from issue #1169576. --> Reported by: [eric_a](https://www.drupal.org/user/344430) Related to !24 >>> <h3 id="summary-problem-motivation">Problem/Motivation</h3> <p><code>admin/content/book/*</code> page allows editors to update the book titles etc.<br> On this page if node title is not set, it still allows to save the book pages form.<br> Because of that, node title becomes empty and thows following errors</p> <pre>The website encountered an unexpected error. Please try again later.&lt;/br&gt;&lt;/br&gt;&lt;em class="placeholder"&gt;Drupal\Core\Entity\EntityStorageException&lt;/em&gt;: SQLSTATE[23000]: Integrity constraint violation: 1048 Column &amp;#039;title&amp;#039; cannot be null: INSERT INTO {node_field_data} (nid, vid, type, langcode, status, title, uid, created, changed, promote, sticky, revision_translation_affected, default_langcode) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5, :db_insert_placeholder_6, :db_insert_placeholder_7, :db_insert_placeholder_8, :db_insert_placeholder_9, :db_insert_placeholder_10, :db_insert_placeholder_11, :db_insert_placeholder_12); Array<br>(<br>&nbsp;&nbsp;&nbsp; [:db_insert_placeholder_0] =&amp;gt; 12<br>&nbsp;&nbsp;&nbsp; [:db_insert_placeholder_1] =&amp;gt; 53<br>&nbsp;&nbsp;&nbsp; [:db_insert_placeholder_2] =&amp;gt; book<br>&nbsp;&nbsp;&nbsp; [:db_insert_placeholder_3] =&amp;gt; en<br>&nbsp;&nbsp;&nbsp; [:db_insert_placeholder_4] =&amp;gt; 1<br>&nbsp;&nbsp;&nbsp; [:db_insert_placeholder_5] =&amp;gt; <br>&nbsp;&nbsp;&nbsp; [:db_insert_placeholder_6] =&amp;gt; 0<br>&nbsp;&nbsp;&nbsp; [:db_insert_placeholder_7] =&amp;gt; 1502214772<br>&nbsp;&nbsp;&nbsp; [:db_insert_placeholder_8] =&amp;gt; 1502619299<br>&nbsp;&nbsp;&nbsp; [:db_insert_placeholder_9] =&amp;gt; 0<br>&nbsp;&nbsp;&nbsp; [:db_insert_placeholder_10] =&amp;gt; 0<br>&nbsp;&nbsp;&nbsp; [:db_insert_placeholder_11] =&amp;gt; 1<br>&nbsp;&nbsp;&nbsp; [:db_insert_placeholder_12] =&amp;gt; 1<br>)</pre><h4 id="summary-steps-reproduce">Steps to reproduce</h4> <p>- Create a book and visit the edit page at "admin/content/book/{book_id}"<br> This page lists all the child pages/chapers in the book where we can re-arrange or change title for the page.<br> - Give the empty tile for the any node.<br> - It still allows editors to submit the form with empty title.<br> - Actually, title field is node title, so we should ensure that it is not empty.<br> - If left empty, it will throw the errors mentioned above. </p> <h3 id="summary-proposed-resolution">Proposed resolution</h3> <p>- Add validation constraints on the form to validate if title is not empty.<br> - Add other necessary validation in place.</p> <h3 id="summary-remaining-tasks">Remaining tasks</h3> <p>- Fix is implemented.<br> - Added test cases.</p> <h3 id="summary-ui-changes">User interface changes</h3> <p>N/A</p> <h3 id="summary-api-changes">API changes</h3> <p>N/A</p> <h3 id="summary-data-model-changes">Data model changes</h3> <p>N/A</p> <h3 id="summary-release-notes">Release notes snippet</h3> <p>N/A</p>
issue