Add parent / child relationship for context
>>> [!note] Migrated issue
<!-- Drupal.org comment -->
<!-- Migrated from issue #3569312. -->
Reported by: [kristen pol](https://www.drupal.org/user/8389)
Related to !47
>>>
<p>[Tracker]<br>
<strong>Update Summary: </strong>[One-line status update for stakeholders]<br>
<strong>Check-in Date: </strong>MM/DD/YYYY<br>
<strong>Blocked by: </strong>[#XXXXXX] (New issues on new lines)<br>
<strong>Additional Collaborators: </strong> @username1, @username2<br>
<em>Metadata is used by the <a href="https://www.drupalstarforge.ai/" title="AI Tracker">AI Tracker.</a> Docs and additional fields <a href="https://www.drupalstarforge.ai/ai-dashboard/docs" title="AI Issue Tracker Documentation">here</a>.</em><br>
[/Tracker]</p>
<h3 id="summary-problem-motivation">Problem/Motivation</h3>
<p>We want to have subcontext items, so we need a parent/child relationship.</p>
<h3 id="summary-proposed-resolution">Proposed resolution</h3>
<p>Add parent to context item content entity.</p>
<h3 id="summary-remaining-tasks">Target date or deadline</h3>
<p>January 2026</p>
<h3 id="summary-remaining-tasks">Remaining tasks</h3>
<ul>
<li>Add context item </li>
<li>Review and test</li>
</ul>
<h3 id="testing-notes">How to test</h3>
<ul>
<li>Install Drupal CMS</li>
<li>Install ai_context (with this MR)</li>
<li>Add a context item: /admin/ai/context/items/add</li>
<li>Add another context item: /admin/ai/context/items/add</li>
<li>For one of the context items, edit it and update the parent to point to the other one</li>
<li>Autocomplete should work as expected</li>
<li>View the context item with a parent, e.g. /admin/ai/context/items/[id]</li>
<li>The parent should show up</li>
<li>Edit again and try to use the same context item and it should show an error on the form field</li>
<li>Check the logs to make sure there are no errors</li>
</ul>
<h3 id="summary-ai-usage">AI usage (if applicable)</h3>
<p>[ ] AI Assisted Issue<br>
This issue was generated with AI assistance, but was reviewed and refined by the creator.</p>
<p>[ ] AI Assisted Code<br>
This code was mainly generated by a human, with AI autocompleting or parts AI generated, but under full human supervision.</p>
<p>[x] AI Generated Code<br>
This code was mainly generated by an AI with human guidance, and reviewed, tested, and refined by a human.</p>
<p>[ ] Vibe Coded<br>
This code was generated by an AI and has only been functionally tested.</p>
> Related issue: [Issue #3569311](https://www.drupal.org/node/3569311)
issue