Skip to content

Commit

Permalink
add to base field
Browse files Browse the repository at this point in the history
  • Loading branch information
edalzell committed Dec 12, 2024
1 parent abaa0c2 commit c33ed4d
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/Fields/Field.php
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,11 @@ public function isFilterable()
return (bool) $this->get('filterable');
}

public function isRevisable()
{
return (bool) $this->get('revisable', true);
}

public function shouldBeDuplicated()
{
if (is_null($this->get('duplicate'))) {
Expand All @@ -269,6 +274,7 @@ public function toPublishArray()
'visibility' => $this->visibility(),
'read_only' => $this->visibility() === 'read_only', // Deprecated: Addon fieldtypes should now reference new `visibility` state.
'always_save' => $this->alwaysSave(),
'revisable' => $this->isRevisable(),
]);
}

Expand Down Expand Up @@ -567,6 +573,13 @@ public static function commonFieldOptions(): Fields
'validate' => 'boolean',
'default' => true,
],
'revisable' => [
'display' => __('Revisable'),
'instructions' => __('statamic::messages.fields_revisable_instructions'),
'type' => 'toggle',
'validate' => 'boolean',
'default' => true,
],
])->map(fn ($field, $handle) => compact('handle', 'field'))->values()->all();

return new ConfigFields($fields);
Expand Down

0 comments on commit c33ed4d

Please sign in to comment.