You are here

public function IntervalItem::buildPHPString in Interval Field 8

Builds a php date interval string from the plugin properties.

Return value

string The interval translated to a php string compatible with \DateTime::modify.

Overrides IntervalItemInterface::buildPHPString

1 call to IntervalItem::buildPHPString()
IntervalItem::applyInterval in src/Plugin/Field/FieldType/IntervalItem.php
Applies an interval to a date object.

File

src/Plugin/Field/FieldType/IntervalItem.php, line 138

Class

IntervalItem
Provides a data type plugin for an interval item.

Namespace

Drupal\interval\Plugin\Field\FieldType

Code

public function buildPHPString() {
  $interval = $this
    ->getIntervalPlugin();
  $value = $this
    ->getInterval() * $interval['multiplier'];
  return $value . ' ' . $interval['php'];
}