protected function ConverterBase::buildFixMe in Drupal 7 to 8/9 Module Upgrader 8
Builds a FIXME notice using either the text in the plugin definition, or passed-in text.
Parameters
string|null $text: The FIXME notice's text, with variable placeholders and no translation.
array $variables: Optional variables to use in translation. If empty, the FIXME will not be translated.
string|null $style: The comment style. Returns a LineCommentBlockNode if this is set to self::LINE_COMMENT, a DocCommentNode if self::DOC_COMMENT, or the FIXME as a string if set to anything else.
Return value
mixed
2 calls to ConverterBase::buildFixMe()
- Blocks::addFixMe in src/
Plugin/ DMU/ Converter/ Blocks.php - Slaps a translated FIXME notice above a block-related hook.
- HookMenuAlter::convert in src/
Plugin/ DMU/ Converter/ HookMenuAlter.php - Performs required conversions.
File
- src/
ConverterBase.php, line 218
Class
- ConverterBase
- Base class for converters.
Namespace
Drupal\drupalmoduleupgraderCode
protected function buildFixMe($text = NULL, array $variables = [], $style = self::LINE_COMMENT) {
$fixMe = "@FIXME\n" . ($text ?: $this->pluginDefinition['fixme']);
if (isset($this->pluginDefinition['documentation'])) {
$fixMe .= "\n";
foreach ($this->pluginDefinition['documentation'] as $doc) {
$fixMe .= "\n@see ";
$fixMe .= isset($doc['url']) ? $doc['url'] : (string) $doc;
}
}
if ($variables) {
$fixMe = (new FormattableMarkup($fixMe, $variables))
->__toString();
}
switch ($style) {
case self::LINE_COMMENT:
return LineCommentBlockNode::create($fixMe);
case self::DOC_COMMENT:
return DocCommentNode::create($fixMe);
default:
return $fixMe;
}
}