You are here

public function Calendar::calendarBuildMiniMonth in Calendar 8

Build one mini month.

1 call to Calendar::calendarBuildMiniMonth()
Calendar::render in src/Plugin/views/style/Calendar.php
Render the display in this style.

File

src/Plugin/views/style/Calendar.php, line 961

Class

Calendar
Views style plugin for the Calendar module.

Namespace

Drupal\calendar\Plugin\views\style

Code

public function calendarBuildMiniMonth() {
  $month = $this->currentDay
    ->format('n');
  $day = $this->currentDay
    ->format('j');
  $this->currentDay
    ->modify('-' . strval($day - 1) . ' days');
  $rows = [];
  do {
    $rows = array_merge($rows, $this
      ->calendarBuildMiniWeek());
    $current_day_date = $this->currentDay
      ->format(DateTimeItemInterface::DATE_STORAGE_FORMAT);
    $current_day_month = $this->currentDay
      ->format('n');
  } while ($current_day_month == $month && $current_day_date <= $this->dateInfo
    ->getMaxDate()
    ->format(DateTimeItemInterface::DATE_STORAGE_FORMAT));

  // Merge the day names in as the first row.
  $rows = array_merge([
    CalendarHelper::weekHeader($this->view),
  ], $rows);
  return $rows;
}