In converting file module to twig, we identified two identical templates that need to be consolidated:
- file-widget.html.twig
- file-managed-file.html.twig

Is there a good reason to keep these separate, or can we consolidate?

Files: 
CommentFileSizeAuthor
#2 consolidate-1926610-2.patch2.58 KBjoelpittet

Comments

joelpittet’s picture

Issue summary: View changes
Issue tags: +Template consolidation
joelpittet’s picture

Struggling with this one because they are kind of different but not sure why it needs to be?

  1. They both have the 'form-managed-file' class. The widget has 'file-widget' and 'clearfix'
  2. file-widget.html.twig is presented on all file upload fields from the Field API. and has a span tag suffixed on the file title with the file size formatted.
  3. file-managed-file.html.twig is used in a number of spots but I could only really test it inside file_module_test test module.
  4. The banana consensus will basically treat classes as part of the markup, so the difference here may prevent consolidation. #2322163: [meta] Consensus Banana Phase 1, move CSS classes from preprocess to twig templates.
  5. file-widget is of type #managed_file with some extra things...

So I'm adding this as a child of that and here is what the patch would look like. May change title and hijack this for that if the difference is significant.

Cottser’s picture

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.