Extracts some logic into resuable methods
This commit is contained in:
@@ -148,4 +148,15 @@ class CustomField extends Model {
|
||||
|
||||
return $custom_field->save();
|
||||
}
|
||||
|
||||
static function extractCustomFieldsFromFromObject($data) {
|
||||
$custom_fields = array();
|
||||
foreach($data as $key => $value) {
|
||||
if(strpos($key, 'cf_') === 0) {
|
||||
$custom_fields[(int)substr($key, 3)] = $value;
|
||||
unset($data[$key]);
|
||||
}
|
||||
}
|
||||
return array($data, $custom_fields);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user