Problem/Motivation

A small cleanup on DateFormat forms and classes. This includes some t() => $this->t() conversions, and removing a few unnecessary use statements.

Steps to reproduce

Proposed resolution

Change the type for $pattern from array to string. The other changes in the latest patch have been made.

Remaining tasks

Patch
Review
Commit

User interface changes

API changes

Data model changes

Release notes snippet

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

herom’s picture

FileSize
445 bytes
8.84 KB

and a bad type-hint.

herom’s picture

rerolled.

andypost’s picture

Skimmed the patch, looks great clean-up.
Probably there's some issue a kind of "Modernize Date* form" but here's more clean-ups.
So please close other issues as dumplicates

To rtbc this patch it needs to check that all t() converted into $this->t()

+++ b/core/modules/system/src/Form/DateFormatFormBase.php
@@ -14,7 +14,6 @@
-use Drupal\Core\Datetime\DrupalDateTime;

@@ -45,8 +44,6 @@
-    $date = new DrupalDateTime();

Just faced with that today and here's a patch :)

henk’s picture

Patch looks good, I was try to find duplication of this task but I don't see anything like this in queue.

There are still some t() not converted into $this->t() but not in the DateFormat context.

jsobiecki’s picture

Patch looks OK for me. I found one execution of function t() (instead of method t()) at /core/modules/config_translation/src/FormElement/DateFormat.php). This one was fixed.

henk’s picture

+1 for that patch

jsobiecki’s picture

Assigned: Unassigned » jsobiecki
Status: Needs review » Needs work
Issue tags: +Needs reroll

This patch doesn't apply anymore. I'm working on re-roll.

jsobiecki’s picture

Assigned: jsobiecki » Unassigned
Status: Needs work » Needs review
Issue tags: -Needs reroll

I prepared re-roll, and now patch applies cleanly. Please review

jsobiecki’s picture

Status: Needs review » Needs work

The last submitted patch, 9: date-format-cleanup-2314645-5.patch, failed testing.

Pawelgorski87’s picture

I prepared patch. Work on 8.0.x.

Pawelgorski87’s picture

Status: Needs work » Needs review
Pawelgorski87’s picture

zaporylie’s picture

This issue is related to #2022875: Resolve difference between submitForm(), submit(), and save() in EntityFormController so you should remove from your patch:

  1. +++ b/core/modules/system/src/Form/DateFormatAddForm.php
    @@ -19,8 +19,16 @@ class DateFormatAddForm extends DateFormatFormBase {
    +  /**
    +   * {@inheritdoc}
    +   */
    +  public function submit(array $form, FormStateInterface $form_state) {
    +    parent::submit($form, $form_state);
    +    drupal_set_message($this->t('Custom date format added.'));
    +  }
    +
    

    this section...

  2. +++ b/core/modules/system/src/Form/DateFormatEditForm.php
    @@ -32,9 +32,17 @@ public function form(array $form, FormStateInterface $form_state) {
    +  /**
    +   * {@inheritdoc}
    +   */
    +  public function submit(array $form, FormStateInterface $form_state) {
    +    parent::submit($form, $form_state);
    +    drupal_set_message($this->t('Custom date format updated.'));
    +  }
    +
    

    ... and this one.

zaporylie’s picture

Status: Needs review » Needs work
ashutoshsngh’s picture

Status: Needs work » Needs review
FileSize
9.04 KB

Removed

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.6 was released on August 2, 2017 and is the final full bugfix release for the Drupal 8.3.x series. Drupal 8.3.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.4.0 on October 4, 2017. (Drupal 8.4.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.4.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.4 was released on January 3, 2018 and is the final full bugfix release for the Drupal 8.4.x series. Drupal 8.4.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.5.0 on March 7, 2018. (Drupal 8.5.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.5.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.6 was released on August 1, 2018 and is the final bugfix release for the Drupal 8.5.x series. Drupal 8.5.x will not receive any further development aside from security fixes. Sites should prepare to update to 8.6.0 on September 5, 2018. (Drupal 8.6.0-rc1 is available for testing.)

Bug reports should be targeted against the 8.6.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.6.x-dev » 8.8.x-dev

Drupal 8.6.x will not receive any further development aside from security fixes. Bug reports should be targeted against the 8.8.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.9.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.7 was released on June 3, 2020 and is the final full bugfix release for the Drupal 8.8.x series. Drupal 8.8.x will not receive any further development aside from security fixes. Sites should prepare to update to Drupal 8.9.0 or Drupal 9.0.0 for ongoing support.

Bug reports should be targeted against the 8.9.x-dev branch from now on, and new development or disruptive changes should be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

quietone’s picture

Title: DateFormat cleanup » Correct the type of $pattern in DateFormat
Version: 8.9.x-dev » 9.3.x-dev
Component: system.module » base system
Category: Task » Bug report
Issue summary: View changes
Issue tags: +Bug Smash Initiative
FileSize
475 bytes

Updated IS, title and patch.

Status: Needs review » Needs work

The last submitted patch, 25: 2314645-25.patch, failed testing. View results

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

smustgrave’s picture

Status: Needs work » Reviewed & tested by the community

Seems like a very simple fix and doesn’t cause any failures

  • larowlan committed fb1847b on 10.1.x
    Issue #2314645 by herom, jsobiecki, Pawelgorski87, quietone,...

  • larowlan committed 0ae2e03 on 10.0.x
    Issue #2314645 by herom, jsobiecki, Pawelgorski87, quietone,...
  • larowlan committed cda0cbb on 9.4.x
    Issue #2314645 by herom, jsobiecki, Pawelgorski87, quietone,...
  • larowlan committed 961f3b7 on 9.5.x
    Issue #2314645 by herom, jsobiecki, Pawelgorski87, quietone,...
larowlan’s picture

Version: 10.1.x-dev » 9.4.x-dev
Status: Reviewed & tested by the community » Fixed

Committed to 10.1.x and cherry-picked all the way back to 9.4.x as there is no disruption risk.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.