Commit d85ee2ed authored by alexpott's avatar alexpott

Issue #2569293 by lauriii, alexpott, dawehner: Replace remaining !placeholder...

Issue #2569293 by lauriii, alexpott, dawehner: Replace remaining !placeholder for Non-URL HTML outputs only in code Table.php
parent 77465e75
......@@ -200,7 +200,7 @@ public static function processTable(&$element, FormStateInterface $form_state, &
}
}
if (isset($title) && $title !== '') {
$title = t('Update !title', array('!title' => $title));
$title = t('Update @title', array('@title' => $title));
}
}
......
......@@ -21,7 +21,7 @@ class TableTest extends KernelTestBase {
*
* @var array
*/
public static $modules = array('system');
public static $modules = ['system', 'form_test'];
/**
* {@inheritdoc}
......@@ -308,4 +308,15 @@ public function testThemeTableRowRenderArray() {
$this->assertRaw('<tbody><tr><td>1-one</td><td>1-two</td><td>1-three</td></tr>', 'Table row 1 found.');
$this->assertRaw('<tr><td>2-one</td><td>2-two</td><td><b>2-three</b></td></tr></tbody>', 'Table row 2 found.');
}
/**
* Tests that the select/checkbox label is being generated and escaped.
*/
public function testThemeTableTitle() {
$form = \Drupal::formBuilder()->getForm('\Drupal\form_test\Form\FormTestTableForm');
$this->render($form);
$this->assertEscaped('Update <em>kitten</em>');
$this->assertRaw('Update my favourite fruit is <strong>bananas</strong>');
}
}
<?php
/**
* @file
* Contains \Drupal\form_test\Form\FormTestTableForm.
*/
namespace Drupal\form_test\Form;
use Drupal\Core\Form\FormStateInterface;
class FormTestTableForm extends FormTestTableSelectFormBase {
/**
* {@inheritdoc}
*/
public function getFormId() {
return '_form_test_table_form';
}
/**
* {@inheritdoc}
*/
public function buildForm(array $form, FormStateInterface $form_state) {
$form['table'] = [
'#type' => 'table',
'#tableselect' => TRUE,
'#empty' => $this->t('Empty text.'),
];
$form['table']['row'] = [
'data' => [
'#title' => '<em>kitten</em>',
'#markup' => '<p>some text</p>',
],
];
$form['table']['another_row'] = [
'data' => [
'#title' => $this->t('my favourite fruit is <strong>@fruit</strong>', ['@fruit' => 'bananas']),
'#markup' => '<p>some more text</p>',
],
];
return $form;
}
/**
* {@inheritdoc}
*/
public function submitForm(array &$form, FormStateInterface $form_state) {
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment