Skip to content

Instantly share code, notes, and snippets.

@radheymkumar
Last active June 29, 2018 13:18
Show Gist options
  • Save radheymkumar/c7c36d49494d9bbfa515b05945877e31 to your computer and use it in GitHub Desktop.
Save radheymkumar/c7c36d49494d9bbfa515b05945877e31 to your computer and use it in GitHub Desktop.
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,
]];
Add Image
new FormattableMarkup('<img src=":img"/>', [':img' => ImageStyle::load('thumbnail')->buildUrl($data->uri)]),
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment