You are here

private function ScheduledPublishGenericFormatter::parseData in Scheduled Publish 8.2

Same name and namespace in other branches
  1. 8.3 src/Plugin/Field/FieldFormatter/ScheduledPublishGenericFormatter.php \Drupal\scheduled_publish\Plugin\Field\FieldFormatter\ScheduledPublishGenericFormatter::parseData()

Parameters

string $strDateTime:

string $strDateFormat:

string $moderationState:

string $pattern:

Return value

string

Throws

\Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException

\Drupal\Component\Plugin\Exception\PluginNotFoundException

1 call to ScheduledPublishGenericFormatter::parseData()
ScheduledPublishGenericFormatter::viewElements in src/Plugin/Field/FieldFormatter/ScheduledPublishGenericFormatter.php
Builds a renderable array for a field value.

File

src/Plugin/Field/FieldFormatter/ScheduledPublishGenericFormatter.php, line 185

Class

ScheduledPublishGenericFormatter
Plugin implementation of the 'scheduled_publish_generic_formatter' formatter.

Namespace

Drupal\scheduled_publish\Plugin\Field\FieldFormatter

Code

private function parseData(string $strDateTime, string $strDateFormat, string $moderationState, string $pattern) : string {
  $date = $this
    ->parseDate($strDateTime, $strDateFormat);
  return str_replace([
    '%moderation_state%',
    '%date%',
  ], [
    $moderationState,
    $date,
  ], $pattern);
}