public function RestfulExampleArticlesResource__1_5::publicFieldsInfo in RESTful 7
Overrides RestfulExampleArticlesResource::publicFieldsInfo().
Overrides RestfulEntityBase::publicFieldsInfo
File
- modules/
restful_example/ plugins/ restful/ node/ articles/ 1.5/ RestfulExampleArticlesResource__1_5.class.php, line 13 - Contains RestfulExampleArticlesResource__1_5.
Class
- RestfulExampleArticlesResource__1_5
- @file Contains RestfulExampleArticlesResource__1_5.
Code
public function publicFieldsInfo() {
$public_fields = parent::publicFieldsInfo();
$public_fields['body'] = array(
'property' => 'body',
'sub_property' => 'value',
);
$public_fields['tags'] = array(
'property' => 'field_tags',
'resource' => array(
'tags' => 'tags',
),
);
$public_fields['image'] = array(
'property' => 'field_image',
'process_callbacks' => array(
array(
$this,
'imageProcess',
),
),
'image_styles' => array(
'thumbnail',
'medium',
'large',
),
);
// By checking that the field exists, we allow re-using this class on
// different tests, where different fields exist.
if (field_info_field('field_images')) {
$public_fields['images'] = array(
'property' => 'field_images',
'process_callbacks' => array(
array(
$this,
'imageProcess',
),
),
'image_styles' => array(
'thumbnail',
'medium',
'large',
),
);
}
$public_fields['user'] = array(
'property' => 'author',
'resource' => array(
// The bundle of the entity.
'user' => array(
// The name of the resource to map to.
'name' => 'users',
// Determines if the entire resource should appear, or only the ID.
'full_view' => TRUE,
),
),
);
$public_fields['static'] = array(
'callback' => 'static::randomNumber',
);
return $public_fields;
}