Problem/Motivation

See #2566503: [meta] Replace remaining !placeholder for Non-URL HTML outputs only

lib/Drupal/Core/Field/Plugin/Field/FieldWidget/EntityReferenceAutocompleteWidget.php:    $summary[] = t('Textfield size: !size', array('!size' => $this->getSetting('size')));
lib/Drupal/Core/Field/Plugin/Field/FieldWidget/OptionsWidgetBase.php:      $form_state->setError($element, t('!name field is required.', array('!name' => $element['#title'])));
lib/Drupal/Core/Field/Plugin/Field/FieldWidget/StringTextareaWidget.php:    $summary[] = t('Number of rows: !rows', array('!rows' => $this->getSetting('rows')));
lib/Drupal/Core/Field/Plugin/Field/FieldWidget/StringTextfieldWidget.php:    $summary[] = t('Textfield size: !size', array('!size' => $this->getSetting('size')));
lib/Drupal/Core/Field/Plugin/Field/FieldWidget/UriWidget.php:    $summary[] = $this->t('URI field size: !size', array('!size' => $this->getSetting('size')));

Proposed resolution

The one remaining question is do translators have a need to add HTML to a date format string?

Remaining tasks

Agree that removing HTML support makes sense.

User interface changes

None

API changes

Date format strings no longer support adding HTML using the \ escape character.

Data model changes

None

Beta phase evaluation

Reference: https://www.drupal.org/core/beta-changes
Issue category Bug because at the moment date formats support HTML but it is escaped
Issue priority Major because part of the critical to remove !placeholder
Disruption Disruptive for existing sites that are adding HTML to date formats. If HTML is required in a formatted date then the site should implement a custom field formatter to do this.
CommentFileSizeAuthor
#4 2571915.patch4.44 KBamateescu
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

dawehner created an issue. See original summary.

dawehner’s picture

Title: Remove HTML support from date formats and replace remaining !placeholder where format_date() and 'date.formatter' => format() are used » Remove HTML support from date formats and replace remaining !placeholder for field widget stuff
dawehner’s picture

Status: Reviewed & tested by the community » Active

Lol no

amateescu’s picture

Status: Active » Needs review
FileSize
4.44 KB

Here we go.

dawehner’s picture

Status: Needs review » Needs work
+++ b/core/lib/Drupal/Core/Field/Plugin/Field/FieldWidget/OptionsWidgetBase.php
@@ -73,7 +73,7 @@ public function formElement(FieldItemListInterface $items, $delta, array $elemen
-      $form_state->setError($element, t('!name field is required.', array('!name' => $element['#title'])));
+      $form_state->setError($element, t('@name field is required.', array('@name' => $element['#title'])));

#title could be a render array at that point. Let's use the render() function for that

pwolanin’s picture

Status: Needs work » Needs review

I disagree - supporting render arrays is out of scope for a ! to @ conversion

pwolanin’s picture

Title: Remove HTML support from date formats and replace remaining !placeholder for field widget stuff » Replace remaining !placeholder for field widget stuff
pwolanin’s picture

Status: Needs review » Reviewed & tested by the community

Looks like a simple 1:1 conversion.

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed a6b4ec0 and pushed to 8.0.x. Thanks!

  • alexpott committed a6b4ec0 on 8.0.x
    Issue #2571915 by amateescu: Replace remaining !placeholder for field...
alexpott’s picture

I agree with @pwolanin that dealing with a markup array is out of scope.

Status: Fixed » Needs work

The last submitted patch, 4: 2571915.patch, failed testing.

stefan.r’s picture

Status: Needs work » Fixed

Status: Fixed » Closed (fixed)

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