Skip to main content
Drupal 8

Main navigation

  • Home
    • Question And Answer
    • NEWS
    • Projects
  • Tutorials - Drupal
    • Android
    • Other
User account menu
  • Log in

Breadcrumb

  1. Home

FormattableMarkup : Add parameters, links to a text, table cell data.

By editor , 22 January, 2018
Question

How to create a  dynamic text to add a parameter or link ?
How to add a link to a table particular column ?

Create a customizable text.

Example :
use Drupal\Component\Render\FormattableMarkup;
$text = new FormattableMarkup('My name is @name', ['@name' => "The name"]);

Theme table row to link particular column data.

Example:
use Drupal\Component\Render\FormattableMarkup;
$rows[] = [
'data' => [
  'name' => new FormattableMarkup('<a href=":link">@name</a>', [':link' => $url, '@name' => $name]),
  'mail' => $row->mail,
]];

Tags

  • Drupal 8
  • Code
  • Theming
  • Add new comment
Create HTML Table. render and theming
Drupal 8's HTML elements render and themes

Comments1

Plain text

  • No HTML tags allowed.
  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.

Campbell Damari (not verified)

8 years 4 months ago

Review

Tables are best in case you're displaying unthinkable information. "div tag is desirable over the table" table is a general guideline that is shamefully connected by individuals who don't hear what they're saying. It's ideal for designing. Best Essay Writing Service. Casings are awful on the grounds that the information is in the wrong request in the record, despite the fact that it indicates appropriately on the site.

  • Reply

Links

  • Drupal.org
  • Drupal core release cycle
  • Drupal events with ease
  • Unit test with Drupal using PHPUnit (Drupal 10)
  • Tokens for file upload url
  • Tips for Docker
  • CKEditor inline image files usage for custom forms.
  • Install Docker on Linux Mint
  • Install PHP 8.1
  • Drupal Security Best Practices
  • Order and sort items with tabledrag
  • Add a custom service YAML container
  • Apply a patch with composer