protected function Calendar::placeNodesInCalendars in Content Planner 8
Place Nodes in Calendar.
Parameters
array $calendar:
array $node_basic_data:
1 call to Calendar::placeNodesInCalendars()
- Calendar::build in modules/
content_calendar/ src/ Component/ Calendar.php - Creates the render array for the calendar.
File
- modules/
content_calendar/ src/ Component/ Calendar.php, line 209
Class
Namespace
Drupal\content_calendar\ComponentCode
protected function placeNodesInCalendars(array &$calendar, array $node_basic_data) {
foreach ($node_basic_data as $node_type => $node_rows) {
foreach ($node_rows as $node_row) {
$calendar_entry = new CalendarEntry($this->month, $this->year, $this
->getNodeTypeConfig($node_type), $node_row);
foreach ($calendar['days'] as &$day) {
// If date of entry is the current date of the calendar day.
if ($day['date'] == $calendar_entry
->formatSchedulingDateAsMySQLDateOnly()) {
// Generate a unique key within the day for the entry.
$key = $calendar_entry
->getRelevantDate() . '_' . $calendar_entry
->getNodeID();
$day['nodes'][$key] = $calendar_entry
->build();
// Sort by keys.
ksort($day['nodes']);
}
}
}
}
}