Issue #2151123 by joelpittet, c4rl, IshaDakota, pplantinga, gnuget, longwave, jeanfei, sbudker1: Remove theme_system_modules_incompatible()

Problem/Motivation

theme_system_modules_incompatible() is just a div wrapping text and probably doesn’t need to be a theme function. It’s only used once in core.

Proposed resolution

Remove theme_system_modules_incompatible() and refactor the render array that uses it. @see \Drupal\system\Form\ModulesListForm::buildRow().

Remaining tasks

  • Patch
  • Patch review
  • Manual testing

Steps to test

  1. Change the version in any module .info.yml to something other than 8.x. Any of these work: 7.x, 9.x, 8.9.
  2. Clear caches.
  3. Visit /admin/modules.

User interface changes

n/a

API changes

The removal of the theme_system_modules_incompatible() theme function.

Comments

star-szr’s picture

Adding a commit message to the issue summary so the folks who already worked on #1987410: [meta] system.module - Convert theme_ functions to Twig and #1898454: system.module - Convert PHPTemplate templates to Twig (comment #41 and above aka @c4rl) get credit.

star-szr’s picture

Issue summary: View changes

Actually adding the commit message this time :)

joelpittet’s picture

Status: Active » Needs review
StatusFileSize
new2.08 KB

Split from the system module twig conversion meta.

star-szr’s picture

Issue tags: +Twig conversion
star-szr’s picture

Issue tags: +Novice

This would be a great one for a new contributor to review and do manual testing on to make sure we're preserving the same markup (whitespace doesn't matter). Posting the before/after HTML in <code> tags is quite helpful or if they are big chunks of markup they can be attached as .txt files.

I suspect that testing this might be as easy as dropping a 7.x module in /modules and navigating to admin/modules.

star-szr’s picture

Issue summary: View changes
Issue tags: +Needs steps to reproduce

Adding a placeholder for testing steps to the issue summary. This should have clear steps to reproduce.

star-szr’s picture

Assigned: Unassigned » joelpittet
Issue summary: View changes

Manually tested by changing the Display Suite .info.yml:

core: 7.x
php: 5.6

It checks out but the markup is slightly different.

Before:

<div class="incompatible">This version is not compatible with Drupal 8.x and should be replaced.This module requires PHP version 5.6.* and is incompatible with PHP version 5.4.26.</div>

After:

<div class="incompatible form-wrapper" id="edit-modules-display-suite-ds-description">This version is not compatible with Drupal 8.x and should be replaced.This module requires PHP version 5.6.* and is incompatible with PHP version 5.4.26.</div>

Is it time for #type wrapper? :)

Assigning to @joelpittet to get his take on this. The markup change certainly doesn't break anything but it seems a bit undesirable to me to have that extra class and ID. Also updated the issue summary with testing steps.

star-szr’s picture

joelpittet’s picture

Assigned: joelpittet » Unassigned

Woah well that sucks.

I think it would be super confusing to have a container and a wrapper type.

I'd much rather make the #type=>'container' be #type=>'form_container', and clean up the namespace for the generic #type=>'container'. It's confusing have a generic template and name for a specific use case like that.

But for this specific one, why is there a div in the first place, let's just put that class on the containing cell with #wrapper_attributes and call it a day?

joelpittet’s picture

Ignore my last suggestion about #wrapper_attributes... that works for #type table cells only.

How about if the 'incompatible' class was attached to the 'summary_attributes' in some how, also that '' same goes for that class too? Though from theming prespective 'incompatible' class should apply to the row so any element within the row could be targed through CSS and not just the title.

As it stands we have a div in a span... which is not cool!

joelpittet’s picture

Example easier stylings.

peri22’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new206.71 KB
new222.58 KB

It works.
I've attached 2 picture, before and after patch.

joelpittet’s picture

sun’s picture

Great to see this! :)

  • Commit f5e0c17 on 8.x by webchick:
    Issue #2151123 by joelpittet | Cottser: Remove...
webchick’s picture

Status: Reviewed & tested by the community » Fixed

Lovely.

Committed and pushed to 8.x. Thanks!

Status: Fixed » Closed (fixed)

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