You are here

public static function PersianDrupalDateTime::createFromDrupalDateTime in Persian Date for Drupal 8 8

Same name and namespace in other branches
  1. 8.4 src/Plugin/Datetime/PersianDrupalDateTime.php \Drupal\persian_date\Plugin\Datetime\PersianDrupalDateTime::createFromDrupalDateTime()
2 calls to PersianDrupalDateTime::createFromDrupalDateTime()
DateTimeWidgetBase::formElement in src/Plugin/Field/FieldWidget/DateTimeWidgetBase.php
Returns the form for a single field widget.
PersianTimestampDateTimeDefaultWidget::formElement in src/Plugin/Field/FieldWidget/PersianTimestampDateTimeDefaultWidget.php
Returns the form for a single field widget.

File

src/Plugin/Datetime/PersianDrupalDateTime.php, line 24

Class

PersianDrupalDateTime

Namespace

Drupal\persian_date\Plugin\Datetime

Code

public static function createFromDrupalDateTime(DrupalDateTime $dateTime) {
  $object = new self();
  $object->dateTimeObject = $dateTime->dateTimeObject;
  $object->langcode = $dateTime->langcode;
  $object->formatTranslationCache = $dateTime->formatTranslationCache;
  $object->stringTranslation = $dateTime->stringTranslation;
  $object->errors = $dateTime->errors;
  $object->inputFormatAdjusted = $dateTime->inputFormatAdjusted;
  $object->inputFormatRaw = $dateTime->inputFormatRaw;
  $object->inputTimeZoneRaw = $dateTime->inputTimeZoneRaw;
  $object->inputTimeZoneAdjusted = $dateTime->inputTimeZoneAdjusted;
  $object->inputTimeRaw = $dateTime->inputTimeRaw;
  $object->inputTimeAdjusted = $dateTime->inputTimeAdjusted;
  return $object;
}