You are here

public function DateRecurDefaultRSet::humanReadable in Recurring Dates Field 8

File

src/DateRecurDefaultRSet.php, line 9

Class

DateRecurDefaultRSet

Namespace

Drupal\date_recur

Code

public function humanReadable() {
  $text = $this->rrules[0]
    ->humanReadable();
  if (!empty($this->rdates)) {
    $dates = [];
    foreach ($this->rdates as $date) {
      $dates[] = $this
        ->formatDateForDisplay($date);
    }
    $text .= ', ' . t('and also on: @dates', [
      '@dates' => implode(', ', $dates),
    ]);
  }
  if (!empty($this->exdates)) {
    $exdates = [];
    foreach ($this->exdates as $date) {
      $exdates[] = $this
        ->formatDateForDisplay($date);
    }
    $text .= ', ' . t('but not on: @dates', [
      '@dates' => implode(', ', $exdates),
    ]);
  }
  return $text;
}