Skip to content

Commit d5d624e

Browse files
authored
Merge pull request #1020 from owlchester/tooltip-mentions
Tooltip mentions
2 parents 3f4f5bf + 5442357 commit d5d624e

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

app/Models/Concerns/HasEntry.php

+5
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@ public function entryFieldName(): string
2424
return $this->entryField ?? 'entry';
2525
}
2626

27+
public function tooltipFieldName(): string
28+
{
29+
return $this->tooltipField ?? 'tooltip';
30+
}
31+
2732
/**
2833
* Get the entry where mentions are parsed to html links
2934
*/

app/Observers/EntryObserver.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public function saving(Model $model)
4040
public function saved(Model $model)
4141
{
4242
// @phpstan-ignore-next-line
43-
if (! $model->isDirty($model->entryFieldName())) {
43+
if (! $model->isDirty($model->entryFieldName()) && ! $model->isDirty($model->tooltipFieldName())) {
4444
return;
4545
}
4646
if (method_exists($model, 'mentions')) {

app/Services/EntityMappingService.php

+4-2
Original file line numberDiff line numberDiff line change
@@ -197,8 +197,10 @@ protected function entry(): self
197197
}
198198

199199
// @phpstan-ignore-next-line
200-
$mentions = $this->extract($this->model->{$this->model->entryFieldName()});
201-
200+
$entryMentions = $this->extract($this->model->{$this->model->entryFieldName()});
201+
// @phpstan-ignore-next-line
202+
$tooltipMentions = $this->extract($this->model->{$this->model->tooltipFieldName()});
203+
$mentions = array_merge($tooltipMentions, $entryMentions);
202204
foreach ($mentions as $data) {
203205
$type = $data['type'];
204206
$id = $data['id'];

0 commit comments

Comments
 (0)