You are here

public function Entity::outputCallback in Open Social 10.1.x

Same name and namespace in other branches
  1. 8.9 modules/custom/mentions/src/Plugin/Mentions/Entity.php \Drupal\mentions\Plugin\Mentions\Entity::outputCallback()
  2. 8 modules/custom/mentions/src/Plugin/Mentions/Entity.php \Drupal\mentions\Plugin\Mentions\Entity::outputCallback()
  3. 8.2 modules/custom/mentions/src/Plugin/Mentions/Entity.php \Drupal\mentions\Plugin\Mentions\Entity::outputCallback()
  4. 8.3 modules/custom/mentions/src/Plugin/Mentions/Entity.php \Drupal\mentions\Plugin\Mentions\Entity::outputCallback()
  5. 8.4 modules/custom/mentions/src/Plugin/Mentions/Entity.php \Drupal\mentions\Plugin\Mentions\Entity::outputCallback()
  6. 8.5 modules/custom/mentions/src/Plugin/Mentions/Entity.php \Drupal\mentions\Plugin\Mentions\Entity::outputCallback()
  7. 8.6 modules/custom/mentions/src/Plugin/Mentions/Entity.php \Drupal\mentions\Plugin\Mentions\Entity::outputCallback()
  8. 8.7 modules/custom/mentions/src/Plugin/Mentions/Entity.php \Drupal\mentions\Plugin\Mentions\Entity::outputCallback()
  9. 8.8 modules/custom/mentions/src/Plugin/Mentions/Entity.php \Drupal\mentions\Plugin\Mentions\Entity::outputCallback()
  10. 10.3.x modules/custom/mentions/src/Plugin/Mentions/Entity.php \Drupal\mentions\Plugin\Mentions\Entity::outputCallback()
  11. 10.0.x modules/custom/mentions/src/Plugin/Mentions/Entity.php \Drupal\mentions\Plugin\Mentions\Entity::outputCallback()
  12. 10.2.x modules/custom/mentions/src/Plugin/Mentions/Entity.php \Drupal\mentions\Plugin\Mentions\Entity::outputCallback()

The outputCallback function.

Parameters

string $mention: The mention.

array|string $settings: The settings.

Return value

mixed Returns mixed.

Overrides MentionsPluginInterface::outputCallback

File

modules/custom/mentions/src/Plugin/Mentions/Entity.php, line 53

Class

Entity
Class Entity.

Namespace

Drupal\mentions\Plugin\Mentions

Code

public function outputCallback($mention, $settings) {
  $entity = $this->entityTypeManager
    ->getStorage($mention['target']['entity_type'])
    ->load($mention['target']['entity_id']);
  $output = [];
  $output['value'] = $this->tokenService
    ->replace($settings['value'], [
    $mention['target']['entity_type'] => $entity,
  ]);
  if ($settings['renderlink']) {
    $output['link'] = $this->tokenService
      ->replace($settings['rendertextbox'], [
      $mention['target']['entity_type'] => $entity,
    ]);
  }
  return $output;
}