protected function Comments__1_0::publicFields in RESTful 7.2
Public fields.
Return value
array The field definition array.
Overrides ResourceEntity::publicFields
File
- modules/
restful_example/ src/ Plugin/ resource/ comment/ Comments__1_0.php, line 37 - Contains \Drupal\restful_example\Plugin\resource\comment\Comments__1_0.
Class
- Comments__1_0
- Class Comments__1_0 @package Drupal\restful_example\Plugin\resource\comment
Namespace
Drupal\restful_example\Plugin\resource\commentCode
protected function publicFields() {
$public_fields = parent::publicFields();
$public_fields['nid'] = array(
'property' => 'node',
'sub_property' => 'nid',
);
// Add a custom field for test only.
if (field_info_field('comment_text')) {
$public_fields['comment_text'] = array(
'property' => 'comment_text',
'sub_property' => 'value',
);
}
return $public_fields;
}