statamic / ideas

💡Discussions on ideas and feature requests for Statamic
https://statamic.dev
31 stars 1 forks source link

Add possibility to override tooltip text for invalid items #922

Open juliawarnke opened 1 year ago

juliawarnke commented 1 year ago

When extending the relationship fieldtype I would like the option to override the tooltip text for the invalid items.

image

Currently it is hard coded in the Item vue component like this:

<div
   v-if="item.invalid"
   v-tooltip.top="__('An item with this ID could not be found')"
   v-text="item.title" />

How it could be controlled in the fieldtype class:

protected function toItemArray($id)
    {
            return [
                'id' => $id,
                'title' => $id,
                'invalid' => true,
                'tooltip' => 'Custom tooltip text',
            ];
    }