Legacy Documentation
You are using the documentation for version 4.3.8. Go here for the latest version.
File Model Extension Hooks¶
before_file_insert¶
-
before_file_insert
($file, $values)¶ Called before the file object is inserted. Changes made to the object will be saved automatically.
How it’s called:
ee()->extensions->call('before_file_insert', $this, $this->getValues());
Parameters: - $file (object) – Current File model object
- $values (array) – The File model object data as an array
Returns: void
Return type: NULL
New in version 3.3.0.
after_file_insert¶
-
after_file_insert
($file, $values)¶ Called after the file object is inserted. Changes made to the object object will not be saved automatically. Saving the object may trigger the save and update hooks.
How it’s called:
ee()->extensions->call('after_file_insert', $this, $this->getValues());
Parameters: - $file (object) – Current File model object
- $values (array) – The File model object data as an array
Returns: void
Return type: NULL
New in version 3.3.0.
before_file_update¶
-
before_file_update
($file, $values, $modified)¶ Called before the file object is updated. Changes made to the object will be saved automatically.
How it’s called:
ee()->extensions->call('before_file_update', $this, $this->getValues(), $modified);
Parameters: - $file (object) – Current File model object
- $values (array) – The File model object data as an array
- $modified (array) – An array of all the old values that were changed
Returns: void
Return type: NULL
New in version 3.3.0.
after_file_update¶
-
after_file_update
($file, $values, $modified)¶ Called after the file object is updated. Changes made to the object will not be saved automatically. Calling save may fire additional hooks.
How it’s called:
ee()->extensions->call('after_file_update', $this, $this->getValues(), $modified);
Parameters: - $file (object) – Current File model object
- $values (array) – The File model object data as an array
- $modified (array) – An array of all the old values that were changed
Returns: void
Return type: NULL
New in version 3.3.0.
before_file_save¶
-
before_file_save
($file, $values)¶ Called before the file object is inserted or updated. Changes made to the object will be saved automatically.
How it’s called:
ee()->extensions->call('before_file_save', $this, $this->getValues());
Parameters: - $file (object) – Current File model object
- $values (array) – The File model object data as an array
Returns: void
Return type: NULL
New in version 3.3.0.
after_file_save¶
-
after_file_save
($file, $values)¶ Called after the file object is inserted or updated. Changes made to the object will not be saved automatically. Calling save may fire additional hooks.
How it’s called:
ee()->extensions->call('after_file_save', $this, $this->getValues());
Parameters: - $file (object) – Current File model object
- $values (array) – The File model object data as an array
Returns: void
Return type: NULL
New in version 3.3.0.
before_file_delete¶
-
before_file_delete
($file, $values)¶ Called before the file object is deleted. If you are conditionally deleting one of your own models, please consider creating an inverse relationship instead. This will provide better performance and strictly enforce data consistency.
How it’s called:
ee()->extensions->call('before_file_delete', $this, $this->getValues());
Parameters: - $file (object) – Current File model object
- $values (array) – The File model object data as an array
Returns: void
Return type: NULL
New in version 3.3.0.
after_file_delete¶
-
after_file_delete
($file, $values)¶ Called after the file object is deleted. If you are conditionally deleting one of your own models, please consider creating an inverse relationship instead. This will provide better performance and strictly enforce data consistency.
How it’s called:
ee()->extensions->call('after_file_delete', $this, $this->getValues());
Parameters: - $file (object) – Current File model object
- $values (array) – The File model object data as an array
Returns: void
Return type: NULL
New in version 3.3.0.
before_file_bulk_delete¶
-
before_file_bulk_delete
($delete_ids)¶ Called before a bulk of file objects are deleted. If you need to do an expensive operation when files are deleted, it may be more efficient to handle it in bulk here.
How it’s called:
ee()->extensions->call('before_file_bulk_delete', $delete_ids);
Parameters: - $delete_ids (array) – The primary key IDs of the models being deleted
Returns: void
Return type: NULL
New in version 4.3.0.
after_file_bulk_delete¶
-
after_file_bulk_delete
($delete_ids)¶ Called after a bulk of file objects are deleted. If you need to do an expensive operation when files are deleted, it may be more efficient to handle it in bulk here.
How it’s called:
ee()->extensions->call('after_file_bulk_delete', $delete_ids);
Parameters: - $delete_ids (array) – The primary key IDs of the models being deleted
Returns: void
Return type: NULL
New in version 4.3.0.