public function MentionsFilter::filterMentions in Open Social 8.2
Same name and namespace in other branches
- 8.9 modules/custom/mentions/src/Plugin/Filter/MentionsFilter.php \Drupal\mentions\Plugin\Filter\MentionsFilter::filterMentions()
- 8 modules/custom/mentions/src/Plugin/Filter/MentionsFilter.php \Drupal\mentions\Plugin\Filter\MentionsFilter::filterMentions()
- 8.3 modules/custom/mentions/src/Plugin/Filter/MentionsFilter.php \Drupal\mentions\Plugin\Filter\MentionsFilter::filterMentions()
- 8.4 modules/custom/mentions/src/Plugin/Filter/MentionsFilter.php \Drupal\mentions\Plugin\Filter\MentionsFilter::filterMentions()
- 8.5 modules/custom/mentions/src/Plugin/Filter/MentionsFilter.php \Drupal\mentions\Plugin\Filter\MentionsFilter::filterMentions()
- 8.6 modules/custom/mentions/src/Plugin/Filter/MentionsFilter.php \Drupal\mentions\Plugin\Filter\MentionsFilter::filterMentions()
- 8.7 modules/custom/mentions/src/Plugin/Filter/MentionsFilter.php \Drupal\mentions\Plugin\Filter\MentionsFilter::filterMentions()
- 8.8 modules/custom/mentions/src/Plugin/Filter/MentionsFilter.php \Drupal\mentions\Plugin\Filter\MentionsFilter::filterMentions()
- 10.3.x modules/custom/mentions/src/Plugin/Filter/MentionsFilter.php \Drupal\mentions\Plugin\Filter\MentionsFilter::filterMentions()
- 10.0.x modules/custom/mentions/src/Plugin/Filter/MentionsFilter.php \Drupal\mentions\Plugin\Filter\MentionsFilter::filterMentions()
- 10.1.x modules/custom/mentions/src/Plugin/Filter/MentionsFilter.php \Drupal\mentions\Plugin\Filter\MentionsFilter::filterMentions()
- 10.2.x modules/custom/mentions/src/Plugin/Filter/MentionsFilter.php \Drupal\mentions\Plugin\Filter\MentionsFilter::filterMentions()
Filters mentions in a text.
Parameters
string $text: The text containing the possible mentions.
Return value
string The processed text.
1 call to MentionsFilter::filterMentions()
- MentionsFilter::process in modules/
custom/ mentions/ src/ Plugin/ Filter/ MentionsFilter.php - Performs the filter processing.
File
- modules/
custom/ mentions/ src/ Plugin/ Filter/ MentionsFilter.php, line 213
Class
- MentionsFilter
- Class FilterMentions.
Namespace
Drupal\mentions\Plugin\FilterCode
public function filterMentions($text) {
$mentions = $this
->getMentions($text);
foreach ($mentions as $match) {
$mention = $this->mentionsManager
->createInstance($match['type']);
if ($mention instanceof MentionsPluginInterface) {
$output_settings = $this->outputSettings[$match['config_name']];
$output = $mention
->outputCallback($match, $output_settings);
$build = [
'#theme' => 'mention_link',
'#mention_id' => $match['target']['entity_id'],
'#link' => $output['link'],
'#render_link' => $output_settings['renderlink'],
'#render_value' => $output['value'],
];
$mentions = $this->renderer
->render($build);
$text = str_replace($match['source']['string'], $mentions, $text);
}
}
return $text;
}