function PlaceholderGenerator::createPlaceholderTag
Generates a placeholder HTML tag.
Parameters
string $tag: The placeholder tag.
array $attributes: An array of key-value pairs to use as tag attributes.
Return value
string The HTML placeholder.
Overrides PlaceholderGeneratorInterface::createPlaceholderTag
2 calls to PlaceholderGenerator::createPlaceholderTag()
- FilterProcessResult::createPlaceholder in core/
modules/ filter/ src/ FilterProcessResult.php - Creates a placeholder.
- PlaceholderGenerator::createPlaceholder in core/
lib/ Drupal/ Core/ Render/ PlaceholderGenerator.php - Turns the given element into a placeholder.
File
-
core/
lib/ Drupal/ Core/ Render/ PlaceholderGenerator.php, line 135
Class
- PlaceholderGenerator
- Turns a render array into a placeholder.
Namespace
Drupal\Core\RenderCode
public static function createPlaceholderTag(string $tag, array $attributes) : string {
$markup = "<{$tag}";
foreach ($attributes as $key => $value) {
if ($value !== '') {
$markup .= ' ' . $key . '="' . Html::escape($value) . '"';
}
}
$markup .= "></{$tag}>";
return $markup;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.