Remove hard-coded <br /> from batch API

Created on 21 August 2015, over 9 years ago
Updated 24 January 2025, 3 days ago

Problem/Motivation

#2548147: All batch labels are HTML escaped โ†’ shows we have three hard-coded <br /> tags in batch API. In general there's almost always a better option than a break tag. Opening this to see if we can remove them.

Steps to reproduce

Need to trigger an error in a batch process.

To test this issue this has been achieved by manually editing a file to break the installer.
However as there is automated testing - and a batch testing module we can

  1. Allow enabling test modules via ->
    $settings[&#039;extension_discovery_scan_tests&#039;] = TRUE; 
    

    in settings.php or settings.local.php if configured

  2. Install batch_test module via the UI or drush
  3. Edit web/core/modules/system/tests/modules/batch_test/src/Controller/BatchTestController.php to introduce an error and visit the appropriate batch. Ideally there would be a test here for this. Perhaps this can be added.
  4. For example edit '_batch_test_title_callback' to be '_batch_test_title_callbackx' then visit /batch-test/test-title
  5. View the output - see the
    in the html and in drupalSettings.

Proposed resolution

For the html - instead of concatenating strings with line breaks between them use an inline template to do this

Remaining tasks

  1. Add a test that demonstrates a failing batch to make testing this easy. And ensure we are not changing the output
  2. Reroll the latest patch against the latest codebase - probably shift to MR. This addresses the line break in drupalSettings only
  3. Address the linebreak in the html output - probably via the same method as above.

User interface changes

Goal here is no changes to UI - we are just shifting where the line break is in code.

Introduced terminology

None

API changes

None

Data model changes

None

Release notes snippet

Note required.

๐Ÿ› Bug report
Status

Needs work

Version

11.0 ๐Ÿ”ฅ

Component

batch system

Created by

๐Ÿ‡ฌ๐Ÿ‡งUnited Kingdom catch

Live updates comments and jobs are added and updated live.
  • CSS

    It involves the content or handling of Cascading Style Sheets.

  • Needs issue summary update

    Issue summaries save everyone time if they are kept up-to-date. See Update issue summary task instructions.

Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024