Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 13 additions & 14 deletions content/collections/pages/field-actions.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ If you are the fieldtype author, you may choose to define actions internally by
computed: {
internalFieldActions() {
return [
{ ... },
{ ... },
{ ... },
{ ... },
];
}
}
}
```

Expand Down Expand Up @@ -102,10 +102,9 @@ The payload provided to the `run`, `quick`, `visible`, and `icon` functions will
| `update` | function | Whatever you pass to this method will update the field's value. When used in a set, this expects a field handle as the first argument. |
| `updateMeta` | function | Whatever you pass to this method will update the field's meta data. When used in a set, this expects a field handle as the first argument. |
| `fieldPathPrefix` | string | The path to the field handle, when nested inside another field like a Grid or Replicator. |
| `vm` | Object | The Vue component |
| `fieldVm` | Object | When inside a Bard or Replicator set, this is the Vue component of the Bard/Replicator. |
| `container` | Object | Context from the [PublishContainer](https://ui.statamic.dev/?path=/docs/components-publishcontainer--docs). |
| `isReadOnly` | bool | Whether the field is read only. |
| `confirmation` | Object | When using a [confirmation modal](#confirmation-modals), this will contain the result of the submission. |
| `confirmation` | Object | When using a [confirmation modal](#confirmation-modals), this will contain the result of the submission. |

## Quick Actions

Expand Down Expand Up @@ -163,7 +162,7 @@ You may also pair this with the `isReadOnly` property within the payload.
visibleWhenReadOnly: true,
run: ({ update, value, isReadOnly }) => {
doSomething();

if (!isReadOnly) update(...);
}
}
Expand All @@ -183,11 +182,11 @@ When running your action, you may use a modal as confirmation and to ask for add
}
```

If the user closes the modal without confirming, the `run` won't be executed.
If the user closes the modal without confirming, the `run` won't be executed.

### Confirmation Modal Options

The `confirm` option will give a generic "Are you sure" prompt if you pass `true`.
The `confirm` option will give a generic "Are you sure" prompt if you pass `true`.

You may pass an options object to the `confirm` property in order to customize it. For example:

Expand All @@ -197,7 +196,7 @@ You may pass an options object to the `confirm` property in order to customize i
title: 'My Modal',
text: 'Are you sure you want to do that?'
}
}
}
```

| Option | Type | Description |
Expand All @@ -206,7 +205,7 @@ You may pass an options object to the `confirm` property in order to customize i
| `buttonText` | string | The text to be displayed in the confirmation button. Default: `Confirm`. |
| `text` | string | The body text. Defaults to `Are you sure?` if the modal would otherwise be empty (no fields, warning text, etc). |
| `warningText` | string | Red warning text. It will be displayed after confirmationText if defined. |
| `dangerous` | bool | Whether the confirmation button should be red. |
| `dangerous` | bool | Whether the confirmation button should be red. |
| `fields` | object | An object containing field definitions. See [fields](#confirmation-modal-fields). |

### Confirmation Modal Fields
Expand Down Expand Up @@ -246,12 +245,12 @@ The `confirmation` property is an object containing the following properties:

## Accessing Other Fields

If you find yourself needing to access other form field values, configs, etc., you can reach into the publish form store from within your `run` function:
If you find yourself needing to access other form field values, configs, etc., you can reach into the publish container within your `run` function:

```js
{
run: ({ store, storeName }) => {
const values = store.state.publish[storeName].values;
run: ({ container }) => {
const values = container.values.value;
}
}
```
3 changes: 2 additions & 1 deletion content/collections/pages/vue-2-to-3.md
Original file line number Diff line number Diff line change
Expand Up @@ -647,5 +647,6 @@ A number of items have been removed. If you feel they shouldn't have been remove
- `resource_url` and `file_icon` methods are no longer available in Vue templates but are still available as global functions.
- The deprecated `$slugify` function has been removed in favor of the `$slug` API.
- The `v-focus` directive has been removed.
- The `store`/`storeName` are no longer included field action payloads.
- The `store`/`storeName` keys are no longer included in field action payloads. You should instead use the `container` context.
- The `vm`/`fieldVm` keys are no longer included in field action payloads.
- The `vue-select` package has been removed. If you're using `<v-select>` you should change to the [Combobox UI component](https://ui.statamic.dev/?path=/docs/forms-combobox--docs).