Loading config/schema/date_range_formatter.schema.yml +0 −6 Original line number Diff line number Diff line Loading @@ -5,12 +5,6 @@ field.formatter.settings.date_range_without_time: separator: type: string label: 'Separator' single: type: date_format label: 'Date format for single date' single_all_day: type: date_format label: 'Date format for the single date if the date is "all day"' one_day: type: date_format label: 'Date format for the single day date range' Loading src/Plugin/Field/FieldFormatter/DateRangeFormatterRangeFormatter.php +2 −16 Original line number Diff line number Diff line Loading @@ -15,7 +15,7 @@ use Drupal\datetime_range\DateTimeRangeTrait; * * @FieldFormatter( * id = "date_range_without_time", * label = @Translation("Date range (without time)"), * label = @Translation("Date range"), * field_types = { * "daterange" * } Loading @@ -31,8 +31,6 @@ class DateRangeFormatterRangeFormatter extends DateTimeCustomFormatter { public static function defaultSettings() { return [ 'separator' => '-', 'single' => 'd F Y', 'single_all_day' => 'd F Y', 'one_day' => 'd F Y', 'one_month' => 'd - {d} F Y', 'several_months' => 'd F - {d} {F} Y', Loading Loading @@ -93,16 +91,6 @@ class DateRangeFormatterRangeFormatter extends DateTimeCustomFormatter { public function settingsForm(array $form, FormStateInterface $form_state) { $form = parent::settingsForm($form, $form_state); unset($form['date_format']); $form['single'] = [ '#type' => 'textfield', '#title' => t('Date format for single date'), '#default_value' => $this->getSetting('single') ? : 'd F Y', ]; $form['single_all_day'] = [ '#type' => 'textfield', '#title' => t('Date format for the single date if the date is "all day"'), '#default_value' => $this->getSetting('single_all_day') ? : 'd F Y', ]; $form['one_day'] = [ '#type' => 'textfield', '#title' => t('Date format for the single day date range'), Loading Loading @@ -138,10 +126,8 @@ class DateRangeFormatterRangeFormatter extends DateTimeCustomFormatter { */ public function settingsSummary() { $summary = parent::settingsSummary(); $summary[] = $this->t('Display date range using formats: @single, @single_all_day, @one_day, @one_month, @several_months, @several_years', $summary[] = $this->t('Display date range using formats: @one_day, @one_month, @several_months, @several_years', array( '@single' => $this->getSetting('single') ? : 'd F Y', '@single_all_day' => $this->getSetting('single_all_day') ? : 'd F Y', '@one_day' => $this->getSetting('one_day') ? : 'd F Y', '@one_month' => $this->getSetting('one_month') ? : 'd - {d} F Y', '@several_months' => $this->getSetting('several_months') ? : 'd F - {d} {F} Y', Loading Loading
config/schema/date_range_formatter.schema.yml +0 −6 Original line number Diff line number Diff line Loading @@ -5,12 +5,6 @@ field.formatter.settings.date_range_without_time: separator: type: string label: 'Separator' single: type: date_format label: 'Date format for single date' single_all_day: type: date_format label: 'Date format for the single date if the date is "all day"' one_day: type: date_format label: 'Date format for the single day date range' Loading
src/Plugin/Field/FieldFormatter/DateRangeFormatterRangeFormatter.php +2 −16 Original line number Diff line number Diff line Loading @@ -15,7 +15,7 @@ use Drupal\datetime_range\DateTimeRangeTrait; * * @FieldFormatter( * id = "date_range_without_time", * label = @Translation("Date range (without time)"), * label = @Translation("Date range"), * field_types = { * "daterange" * } Loading @@ -31,8 +31,6 @@ class DateRangeFormatterRangeFormatter extends DateTimeCustomFormatter { public static function defaultSettings() { return [ 'separator' => '-', 'single' => 'd F Y', 'single_all_day' => 'd F Y', 'one_day' => 'd F Y', 'one_month' => 'd - {d} F Y', 'several_months' => 'd F - {d} {F} Y', Loading Loading @@ -93,16 +91,6 @@ class DateRangeFormatterRangeFormatter extends DateTimeCustomFormatter { public function settingsForm(array $form, FormStateInterface $form_state) { $form = parent::settingsForm($form, $form_state); unset($form['date_format']); $form['single'] = [ '#type' => 'textfield', '#title' => t('Date format for single date'), '#default_value' => $this->getSetting('single') ? : 'd F Y', ]; $form['single_all_day'] = [ '#type' => 'textfield', '#title' => t('Date format for the single date if the date is "all day"'), '#default_value' => $this->getSetting('single_all_day') ? : 'd F Y', ]; $form['one_day'] = [ '#type' => 'textfield', '#title' => t('Date format for the single day date range'), Loading Loading @@ -138,10 +126,8 @@ class DateRangeFormatterRangeFormatter extends DateTimeCustomFormatter { */ public function settingsSummary() { $summary = parent::settingsSummary(); $summary[] = $this->t('Display date range using formats: @single, @single_all_day, @one_day, @one_month, @several_months, @several_years', $summary[] = $this->t('Display date range using formats: @one_day, @one_month, @several_months, @several_years', array( '@single' => $this->getSetting('single') ? : 'd F Y', '@single_all_day' => $this->getSetting('single_all_day') ? : 'd F Y', '@one_day' => $this->getSetting('one_day') ? : 'd F Y', '@one_month' => $this->getSetting('one_month') ? : 'd - {d} F Y', '@several_months' => $this->getSetting('several_months') ? : 'd F - {d} {F} Y', Loading