extended-acf
extended-acf copied to clipboard
Adjust dump method in Extended\ACF\Fields\Field to utilize object cloning
This PR will fix #153.
Description
This pull request refactors the get method in the Extended\ACF\Fields\Field class to utilize PHP object cloning. The changes ensure that field instances, particularly those with sub_fields, layouts, and conditional_logic, are processed independently, preventing unintended modifications to the original objects during method execution.
Changes Made
- Object Cloning: Implemented object cloning in the get method to create independent instances of sub_fields, layouts, and conditional_logic before processing.
- Safety Checks: Added conditional checks to ensure clone is only applied to objects, safeguarding against potential errors when dealing with non-object types.