Store: content
Interact with the current form content as well as all unsaved changes.
We use Vuex to ensure a consistent state of data throughout the Panel. If you have not worked with Vuex before, you should first familiarize yourself with their documentation.
State
Key | Description |
---|---|
current |
ID of the current model (with translation suffix) |
models |
Array of already loaded models |
status |
Object with enabled (bool), lock and unlock (objects or null ) |
Getters
Key | Parameters | Description |
---|---|---|
exists |
id |
Checks if a model exists in the store |
hasChanges |
id (optional) |
Checks if a model has unsaved changes |
id |
id |
Returns ID (current or provided) with correct language suffix |
isCurrent |
id |
Checks if specified ID is the current model |
model |
id (optional) |
Returns the full model object |
originals |
id (optional) |
Returns all original values (as in content file) for a model |
changes |
id (optional) |
Returns all unsaved changes for a model |
values |
id (optional) |
Returns all values for a model (originals updated with unsaved changes) |
Actions
Key | Parameters | Description |
---|---|---|
create |
model |
Create a store entry for a model |
current |
id |
Set the current model |
disable |
Disable content forms | |
enable |
Enable content forms | |
init |
Initializes store with data from localStorage |
|
lock |
lock |
Set data for content lock |
move |
[oldId, newId] |
Move a store entry for a model |
remove |
id |
Remove a model from store |
revert |
id (optional) |
Discard unsaved changes for a model |
save |
id (optional) |
Update content file for a model |
unlock |
unlock |
Set data for onlocked content lock |
update |
[field, value, id] (id optional) |
Update a field value for a model |