View source
<?php
namespace Drupal\restful_test\Plugin\resource\entity_test\main\v1;
use Drupal\restful\Plugin\resource\ResourceInterface;
class Main__1_7 extends Main__1_0 implements ResourceInterface {
protected function publicFields() {
$public_fields = parent::publicFields();
$public_fields['uuid'] = array(
'property' => 'uuid',
'methods' => array(),
);
$public_fields['entity_reference_single'] = array(
'property' => 'entity_reference_single',
'referencedIdProperty' => 'uuid',
);
$public_fields['entity_reference_resource'] = array(
'property' => 'entity_reference_single',
'referencedIdProperty' => 'uuid',
'resource' => array(
'name' => 'main',
'majorVersion' => 1,
'minorVersion' => 7,
),
);
$public_fields['entity_reference_multiple'] = array(
'property' => 'entity_reference_multiple',
'referencedIdProperty' => 'uuid',
);
$public_fields['term_single'] = array(
'property' => 'term_single',
'referencedIdProperty' => 'uuid',
);
$public_fields['term_multiple'] = array(
'property' => 'term_multiple',
'referencedIdProperty' => 'uuid',
);
$public_fields['file_single'] = array(
'property' => 'file_single',
'class' => '\\Drupal\\restful\\Plugin\\resource\\Field\\ResourceFieldFileEntityReference',
'referencedIdProperty' => 'uuid',
);
$public_fields['file_multiple'] = array(
'property' => 'file_multiple',
'class' => '\\Drupal\\restful\\Plugin\\resource\\Field\\ResourceFieldFileEntityReference',
'referencedIdProperty' => 'uuid',
);
return $public_fields;
}
protected function processPublicFields(array $field_definitions) {
if (variable_get('restful_test_alternative_id_error', FALSE)) {
$field_definitions['entity_reference_resource_error'] = array(
'property' => 'entity_reference_single',
'referencedIdProperty' => 'uuid',
'resource' => array(
'name' => 'main',
'majorVersion' => 1,
'minorVersion' => 6,
),
);
}
return parent::processPublicFields($field_definitions);
}
}