You are here

protected function ApprovalPollViewForm::getStartTimestamp in Advanced Poll 8

Get start timestamp.

Return value

int

2 calls to ApprovalPollViewForm::getStartTimestamp()
ApprovalPollViewForm::buildForm in src/Form/ApprovalPollViewForm.php
Form constructor.
ApprovalPollViewForm::showResults in src/Form/ApprovalPollViewForm.php

File

src/Form/ApprovalPollViewForm.php, line 369

Class

ApprovalPollViewForm
Class ApprovalPollViewForm

Namespace

Drupal\advpoll\Form

Code

protected function getStartTimestamp() {
  $startTimestamp = 0;
  if ($this->poll
    ->hasField('field_start_date') && !$this->poll
    ->get('field_start_date')
    ->isEmpty()) {

    /** @var \Drupal\Core\Datetime\DrupalDateTime $startDateTime */
    $startDateTime = $this->poll
      ->get('field_start_date')->date;
    $startTimestamp = $startDateTime
      ->getTimestamp();
  }
  return $startTimestamp;
}