function TimestampAgoFormatter::create

Same name in other branches
  1. 8.9.x core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/TimestampAgoFormatter.php \Drupal\Core\Field\Plugin\Field\FieldFormatter\TimestampAgoFormatter::create()
  2. 10 core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/TimestampAgoFormatter.php \Drupal\Core\Field\Plugin\Field\FieldFormatter\TimestampAgoFormatter::create()
  3. 11.x core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/TimestampAgoFormatter.php \Drupal\Core\Field\Plugin\Field\FieldFormatter\TimestampAgoFormatter::create()

Overrides FormatterBase::create

File

core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/TimestampAgoFormatter.php, line 77

Class

TimestampAgoFormatter
Plugin implementation of the 'timestamp' formatter as time ago.

Namespace

Drupal\Core\Field\Plugin\Field\FieldFormatter

Code

public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
    // @see \Drupal\Core\Field\FormatterPluginManager::createInstance().
    return new static($plugin_id, $plugin_definition, $configuration['field_definition'], $configuration['settings'], $configuration['label'], $configuration['view_mode'], $configuration['third_party_settings'], $container->get('date.formatter'), $container->get('request_stack')
        ->getCurrentRequest());
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.