$date_formats[static::CUSTOM_DATE_FORMAT
] =
$this->
t('Custom'
);
$time_diff =
$this->
getSetting('time_diff'
);
$form['time_diff'
]['#tree'
] = TRUE;
$form['time_diff'
]['enabled'
] =
[ '#type' => 'checkbox',
'#title' =>
$this->
t("Display as a time difference (e.g. '6 months ago')"
),
'#default_value' =>
$time_diff['enabled'
],
];
$states =
$this->
buildStates(['time_diff', 'enabled'
],
['checked' => TRUE
]);
$form['time_diff'
]['future_format'
] =
[ '#type' => 'textfield',
'#title' =>
$this->
t('Future format'
),
'#description' =>
$this->
t("Use the <code>@interval</code> placeholder to represent the formatted time difference interval. E.g. <code>@interval hence</code> will be displayed as <em>2 hours 5 minutes hence</em>."
),
'#default_value' =>
$time_diff['future_format'
],
'#states' =>
$states,
];
$form['time_diff'
]['past_format'
] =
[ '#type' => 'textfield',