You are here

public static function DateRecurGranularityMap::granularityExpectedFormatMessages in Recurring Dates Field 3.0.x

Same name and namespace in other branches
  1. 8.2 src/DateRecurGranularityMap.php \Drupal\date_recur\DateRecurGranularityMap::granularityExpectedFormatMessages()
  2. 3.x src/DateRecurGranularityMap.php \Drupal\date_recur\DateRecurGranularityMap::granularityExpectedFormatMessages()
  3. 3.1.x src/DateRecurGranularityMap.php \Drupal\date_recur\DateRecurGranularityMap::granularityExpectedFormatMessages()

Granularities and their associated failed validation message labels.

Parameters

string $sample: A sample string.

Return value

\Drupal\Core\StringTranslation\TranslatableMarkup[] Failed validation messages for granularities keyed by granularity.

1 call to DateRecurGranularityMap::granularityExpectedFormatMessages()
DateRecurFilter::validateValue in src/Plugin/views/filter/DateRecurFilter.php
Form field validator.

File

src/DateRecurGranularityMap.php, line 70

Class

DateRecurGranularityMap
Granularity maps.

Namespace

Drupal\date_recur

Code

public static function granularityExpectedFormatMessages(string $sample) : array {
  return [
    'year' => \t('YYYY (Year, for example: @sample)', [
      '@sample' => $sample,
    ]),
    'month' => \t('YYYY-MM (Year-month, for example: @sample)', [
      '@sample' => $sample,
    ]),
    'day' => \t('YYYY-MM-DD (Year-month-day, for example: @sample)', [
      '@sample' => $sample,
    ]),
    'second' => \t('YYYY-MM-DDTHH:MM:SS (for example: @sample)', [
      '@sample' => $sample,
    ]),
  ];
}