Refactor _calc_indents(): accept CalendarEvent only
>>> [!note] Migrated issue <!-- Drupal.org comment --> <!-- Migrated from issue #3546000. --> Reported by: [joelpittet](https://www.drupal.org/user/160302) Related to !71 >>> <h3 id="summary-problem-motivation">Problem/Motivation</h3> <p><code>_calc_indents()</code> accepted mixed <code>$item</code> types (object/array), causing branching and inconsistent <code>indent</code>/<code>max_depth</code> handling.</p> <h3 id="summary-proposed-resolution">Proposed resolution</h3> <ul> <li>Require <code>\Drupal\calendar\CalendarEvent</code> for <code>$item</code> only.</li> <li>Update signature:<br><br> <code>function _calc_indents(array &amp;$overlapped_items, string $start, string $end, CalendarEvent &amp;$item, int $depth = 0): array</code> </li> <li>Always set <code>$item-&gt;indent</code> and <code>$item-&gt;max_depth</code> on the object; remove array writes/branches.</li> <li>Callers: <ul> <li>Day view: pass the event object.</li> <li>Week view: pass <code>$item['item']</code> (the <code>CalendarEvent</code>) and read values from it.</li> </ul> </li> <li>Keep <code>$overlapped_items</code> structure; ensure each <code>entry['item']</code> is a <code>CalendarEvent</code>.</li> </ul> <h3>BC</h3> <p>Private helper; internal call sites updated.</p>
issue