Commit d85ee2ed authored by Alex Pott's avatar Alex Pott
Browse files

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
Loading
Loading
Loading
Loading
+1 −1
Changes for core/lib/Drupal/Core/Render/Element/Table.php: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -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));
            }
          }

+12 −1
Changes for core/modules/system/src/Tests/Theme/TableTest.php: 12 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -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>');
  }

}
+52 −0
Changes for core/modules/system/tests/modules/form_test/src/Form/FormTestTableForm.php: 52 added lines, 0 removed lines.
Original line number Diff line number Diff line
<?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) {
  }

}