mirror of
https://github.com/processwire/processwire.git
synced 2025-08-12 17:54:44 +02:00
Add a new Fieldtype::savedField interface method so that Fieldtypes can monitor when a field of their type has been saved, without having to attach a hook
This commit is contained in:
@@ -300,6 +300,8 @@ class Fields extends WireSaveableItems {
|
||||
}
|
||||
}
|
||||
|
||||
if($item->type) $item->type->savedField($item);
|
||||
|
||||
$this->getTags('reset');
|
||||
|
||||
return true;
|
||||
|
@@ -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
|
||||
*
|
||||
|
Reference in New Issue
Block a user