diff --git a/wire/core/Fields.php b/wire/core/Fields.php index ee76f742..4f8b7179 100644 --- a/wire/core/Fields.php +++ b/wire/core/Fields.php @@ -300,6 +300,8 @@ class Fields extends WireSaveableItems { } } + if($item->type) $item->type->savedField($item); + $this->getTags('reset'); return true; diff --git a/wire/core/Fieldtype.php b/wire/core/Fieldtype.php index 45e21619..7e351889 100644 --- a/wire/core/Fieldtype.php +++ b/wire/core/Fieldtype.php @@ -46,6 +46,7 @@ * @method bool deleteTemplateField(Template $template, Field $field) * @method Field cloneField(Field $field) * @method void renamedField(Field $field, $prevName) + * @method void savedField(Field $field) * @method void install() * @method void uninstall() * @@ -1474,6 +1475,19 @@ abstract class Fieldtype extends WireData implements Module { if($field && $prevName) {} } + /** + * Called when Field using this Fieldtype has been saved + * + * This is primarily so that Fieldtype modules can identify when their fields are + * saved without having to add a hook to the $fields API var. + * + * @param Field $field + * @since 3.0.171 + * + */ + public function ___savedField(Field $field) { + } + /** * Get a property from this Fieldtype’s data *