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;
  }
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;
  }
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 ; }
Filters mentions in a text.

@param string $text
The text containing the possible mentions.

@return string
The processed text.
Filters mentions in a text .