public function RestfulEntityBase::propertyValuesPreprocess in RESTful 7
Massage the value to set according to the format expected by the wrapper.
Parameters
string $property_name: The property name to set.
$value: The value passed in the request.
string $public_field_name: The name of the public field to set.
Return value
mixed The value to set using the wrapped property.
1 call to RestfulEntityBase::propertyValuesPreprocess()
- RestfulEntityBase::setPropertyValues in plugins/
restful/ RestfulEntityBase.php - Set properties of the entity based on the request, and save the entity.
File
- plugins/
restful/ RestfulEntityBase.php, line 746 - Contains RestfulEntityBase.
Class
- RestfulEntityBase
- An abstract implementation of RestfulEntityInterface.
Code
public function propertyValuesPreprocess($property_name, $value, $public_field_name) {
// If value is NULL, just return.
if (!isset($value)) {
return NULL;
}
// Get the field info.
$field_info = field_info_field($property_name);
switch ($field_info['type']) {
case 'entityreference':
case 'taxonomy_term_reference':
case 'field_collection':
case 'commerce_product_reference':
case 'commerce_line_item_reference':
return $this
->propertyValuesPreprocessReference($property_name, $value, $field_info, $public_field_name);
case 'text':
case 'text_long':
case 'text_with_summary':
return $this
->propertyValuesPreprocessText($property_name, $value, $field_info);
case 'file':
case 'image':
return $this
->propertyValuesPreprocessFile($property_name, $value, $field_info);
}
// Return the value as is.
return $value;
}