When configuring the text filters for a given text format (e.g. /admin/config/content/formats/manage/full_html), the module causes a notice due to using an invalid placeholder in !Help. The available placeholders are described in FormattableMarkup::placeholderFormat.

User error: Invalid placeholder (!Help) in string: !Help in Drupal\Component\Render\FormattableMarkup::placeholderFormat() (line 235 of core/lib/Drupal/Component/Render/FormattableMarkup.php).
Drupal\Component\Render\FormattableMarkup::placeholderFormat('!Help', Array) (Line: 204)
...

Current code:

$form['config'] = array(
  '#prefix' => t('!Help', array('!Help' => \Drupal::l('Help', Url::fromUri('base:admin/help/htmlawed')))),
  '#type' => 'textarea',
  '#rows' => '2',
  '#title' => $this->t('Config.'),
  '#default_value' => $htmLawed_settings['config'],
  '#description' => $this->t("Comma-separated, quoted key-value pairs that will be used for htmLawed's %config parameter", array('%config' => 'config')),
);

Suggested change:

$form['config'] = array(
  '#prefix' => t('<a href=":url">Help</a>', array(':url' => Url::fromUri('base:admin/help/htmlawed')->toString())),
  '#type' => 'textarea',
  '#rows' => '2',
  '#title' => $this->t('Config.'),
  '#default_value' => $htmLawed_settings['config'],
  '#description' => $this->t("Comma-separated, quoted key-value pairs that will be used for htmLawed's %config parameter", array('%config' => 'config')),
);

Comments

ckaotik created an issue. See original summary.

alpha2zee’s picture

Assigned: Unassigned » alpha2zee
Status: Active » Fixed

Thank you for picking this bug and suggesting the fix, which works. I am releasing a new version of the module with this fix.

alpha2zee’s picture

Status: Fixed » Closed (fixed)