TimestampTimeAgoListFormatter.php in Formatter Suite 8
File
src/Plugin/Field/FieldFormatter/TimestampTimeAgoListFormatter.php
View source
<?php
namespace Drupal\formatter_suite\Plugin\Field\FieldFormatter;
use Drupal\Core\Field\Plugin\Field\FieldFormatter\TimestampAgoFormatter;
class TimestampTimeAgoListFormatter extends TimestampAgoFormatter {
use EntityListTrait;
protected function getDescription() {
return $this
->t("Format multi-value timestamp fields as a list. Values are used to calculate a time period between the current date and the field's date. The time period is presented with a selected granularity.");
}
protected function postProcessSettingsForm(array $elements) {
if (isset($elements['future_format']) === TRUE) {
$elements['future_format']['#size'] = 10;
$elements['future_format']['#attributes']['size'] = 10;
$elements['future_format']['#attributes']['spellcheck'] = FALSE;
$elements['future_format']['#attributes']['autocomplete'] = 'off';
$elements['future_format']['#attributes']['autocapitalize'] = 'none';
$elements['future_format']['#attributes']['autocorrect'] = 'off';
}
if (isset($elements['past_format']) === TRUE) {
$elements['past_format']['#size'] = 10;
$elements['past_format']['#attributes']['size'] = 10;
$elements['past_format']['#attributes']['spellcheck'] = FALSE;
$elements['past_format']['#attributes']['autocomplete'] = 'off';
$elements['past_format']['#attributes']['autocapitalize'] = 'none';
$elements['past_format']['#attributes']['autocorrect'] = 'off';
}
return $elements;
}
}