You are here

public static function PersianDateTime::formatExample in Persian Date for Drupal 8 8

Same name and namespace in other branches
  1. 8.4 src/Element/PersianDateTime.php \Drupal\persian_date\Element\PersianDateTime::formatExample()

Creates an example for a date format.

This is centralized for a consistent method of creating these examples.

Parameters

string $format:

Return value

string

Overrides Datetime::formatExample

1 call to PersianDateTime::formatExample()
PersianTimestampDateTimeDefaultWidget::formElement in src/Plugin/Field/FieldWidget/PersianTimestampDateTimeDefaultWidget.php
Returns the form for a single field widget.

File

src/Element/PersianDateTime.php, line 32

Class

PersianDateTime
Class PersianDateTime @package Drupal\persian_date\Element

Namespace

Drupal\persian_date\Element

Code

public static function formatExample($format) {
  if (!static::$dateExample) {
    static::$dateExample = new PersianDrupalDateTime();
  }
  return static::$dateExample
    ->format($format);
}