public function Entity::targetCallback in Open Social 8.8
Same name and namespace in other branches
- 8.9 modules/custom/mentions/src/Plugin/Mentions/Entity.php \Drupal\mentions\Plugin\Mentions\Entity::targetCallback()
- 8 modules/custom/mentions/src/Plugin/Mentions/Entity.php \Drupal\mentions\Plugin\Mentions\Entity::targetCallback()
- 8.2 modules/custom/mentions/src/Plugin/Mentions/Entity.php \Drupal\mentions\Plugin\Mentions\Entity::targetCallback()
- 8.3 modules/custom/mentions/src/Plugin/Mentions/Entity.php \Drupal\mentions\Plugin\Mentions\Entity::targetCallback()
- 8.4 modules/custom/mentions/src/Plugin/Mentions/Entity.php \Drupal\mentions\Plugin\Mentions\Entity::targetCallback()
- 8.5 modules/custom/mentions/src/Plugin/Mentions/Entity.php \Drupal\mentions\Plugin\Mentions\Entity::targetCallback()
- 8.6 modules/custom/mentions/src/Plugin/Mentions/Entity.php \Drupal\mentions\Plugin\Mentions\Entity::targetCallback()
- 8.7 modules/custom/mentions/src/Plugin/Mentions/Entity.php \Drupal\mentions\Plugin\Mentions\Entity::targetCallback()
- 10.3.x modules/custom/mentions/src/Plugin/Mentions/Entity.php \Drupal\mentions\Plugin\Mentions\Entity::targetCallback()
- 10.0.x modules/custom/mentions/src/Plugin/Mentions/Entity.php \Drupal\mentions\Plugin\Mentions\Entity::targetCallback()
- 10.1.x modules/custom/mentions/src/Plugin/Mentions/Entity.php \Drupal\mentions\Plugin\Mentions\Entity::targetCallback()
- 10.2.x modules/custom/mentions/src/Plugin/Mentions/Entity.php \Drupal\mentions\Plugin\Mentions\Entity::targetCallback()
The targetCallback function.
Parameters
string $value: The value.
array|string $settings: The settings.
Return value
mixed Returns mixed.
Overrides MentionsPluginInterface::targetCallback
File
- modules/
custom/ mentions/ src/ Plugin/ Mentions/ Entity.php, line 66
Class
- Entity
- Class Entity.
Namespace
Drupal\mentions\Plugin\MentionsCode
public function targetCallback($value, $settings) {
$entity_type = $settings['entity_type'];
$input_value = $settings['value'];
$query = $this->entityQueryService
->get($entity_type);
$result = $query
->condition($input_value, $value)
->execute();
if (!empty($result)) {
$result = reset($result);
$target['entity_type'] = $entity_type;
$target['entity_id'] = $result;
return $target;
}
else {
return FALSE;
}
}