/**
  * Overrides ResourceEntity::publicFields().
  */
 public function publicFields()
 {
     $public_fields = parent::publicFields();
     $public_fields['body'] = array('property' => 'body', 'sub_property' => 'value');
     // By checking that the field exists, we allow re-using this class on
     // different tests, where different fields exist.
     if (field_info_field('entity_reference_single')) {
         $public_fields['entity_reference_single'] = array('property' => 'entity_reference_single', 'resource' => array('name' => 'test_articles', 'majorVersion' => 1, 'minorVersion' => 2));
     }
     if (field_info_field('entity_reference_multiple')) {
         $public_fields['entity_reference_multiple'] = array('property' => 'entity_reference_multiple', 'resource' => array('name' => 'test_articles', 'majorVersion' => 1, 'minorVersion' => 2));
     }
     if (field_info_field('integer_single')) {
         $public_fields['integer_single'] = array('property' => 'integer_single');
     }
     if (field_info_field('integer_multiple')) {
         $public_fields['integer_multiple'] = array('property' => 'integer_multiple');
     }
     if (variable_get('restful_test_reference_simple')) {
         $public_fields['user'] = array('property' => 'author');
         if (variable_get('restful_test_reference_resource')) {
             $public_fields['user']['resource'] = array('name' => 'users', 'majorVersion' => 1, 'minorVersion' => 0);
         }
     }
     return $public_fields;
 }
Пример #2
0
 /**
  * {@inheritdoc
  */
 protected function publicFields()
 {
     $public_fields = parent::publicFields();
     $public_fields['name'] = $public_fields['label'];
     unset($public_fields['label']);
     $public_fields['bundle'] = array('wrapper_method' => 'getBundle', 'wrapper_method_on_entity' => TRUE);
     return $public_fields;
 }
Пример #3
0
 /**
  * {@inheritdoc}
  */
 protected function publicFields()
 {
     $public_fields = parent::publicFields();
     unset($public_fields['self']);
     $public_fields['nid'] = array('wrapper_method' => 'getIdentifier', 'wrapper_method_on_entity' => TRUE, 'methods' => array(RequestInterface::METHOD_GET));
     $public_fields['description'] = array('property' => 'body', 'sub_property' => 'value');
     return $public_fields;
 }
Пример #4
0
 /**
  * {@inheritdoc}
  */
 protected function publicFields()
 {
     $public_fields = parent::publicFields();
     $public_fields['name'] = $public_fields['label'];
     unset($public_fields['label']);
     $public_fields['location'] = array('property' => 'field_address', 'process_callbacks' => array(array($this, 'locationProcess')));
     $public_fields['url'] = array('wrapper_method' => 'value', 'wrapper_method_on_entity' => TRUE, 'process_callbacks' => array(array($this, 'uriProcess')));
     return $public_fields;
 }
 /**
  * {@inheritdoc}
  */
 protected function publicFields()
 {
     $public_fields = parent::publicFields();
     if (!module_exists('entity_validator')) {
         return $public_fields;
     }
     $public_fields['title'] = $public_fields['label'];
     $public_fields['body'] = array('property' => 'body', 'sub_property' => 'value');
     return $public_fields;
 }
Пример #6
0
 /**
  * {@inheritdoc
  */
 protected function publicFields()
 {
     $public_fields = parent::publicFields();
     $public_fields['name'] = $public_fields['label'];
     unset($public_fields['label']);
     $public_fields['bundle'] = array('wrapper_method' => 'getBundle', 'wrapper_method_on_entity' => TRUE);
     $public_fields['image'] = array();
     $public_fields['image'] = array('property' => 'field_image', 'process_callbacks' => array(array($this, 'imageUrl')));
     return $public_fields;
 }
Пример #7
0
 /**
  * {@inheritdoc
  */
 protected function publicFields()
 {
     $public_fields = parent::publicFields();
     $public_fields['name'] = $public_fields['label'];
     unset($public_fields['label']);
     $public_fields['image'] = array('property' => 'field_image', 'process_callbacks' => array(array($this, 'renderImage')));
     $public_fields['youtube'] = array('property' => 'field_youtube');
     $public_fields['genres'] = array('property' => 'field_genres');
     $public_fields['url'] = array('wrapper_method' => 'value', 'wrapper_method_on_entity' => TRUE, 'process_callbacks' => array(array($this, 'uriProcess')));
     return $public_fields;
 }
Пример #8
0
 /**
  * {@inheritdoc
  */
 protected function publicFields()
 {
     $public_fields = parent::publicFields();
     $public_fields['name'] = $public_fields['label'];
     unset($public_fields['label']);
     $public_fields['social'] = array('property' => 'field_social', 'formatter' => 'socialfield_formatter');
     $public_fields['image'] = array('property' => 'field_image', 'process_callbacks' => array(array($this, 'renderImage')));
     $public_fields['youtube'] = array('property' => 'field_youtube');
     $public_fields['about'] = array('property' => 'field_about');
     $public_fields['genres'] = array('property' => 'field_genres', 'formatter' => 'term_term');
     return $public_fields;
 }
Пример #9
0
 /**
  * {@inheritdoc
  */
 protected function publicFields()
 {
     $public_fields = parent::publicFields();
     $public_fields['name'] = $public_fields['label'];
     unset($public_fields['label']);
     unset($public_fields['self']);
     unset($public_fields['links']);
     $public_fields['url'] = array('wrapper_method' => 'value', 'wrapper_method_on_entity' => TRUE, 'process_callbacks' => array(array($this, 'uriProcess')));
     $public_fields['image'] = array('property' => 'field_image');
     $public_fields['genres'] = array('property' => 'field_genres', 'resource' => array('name' => 'genres', 'majorVersion' => 1, 'minorVersion' => 0));
     return $public_fields;
 }
 /**
  * {@inheritdoc}
  */
 protected function publicFields()
 {
     $public_fields = parent::publicFields();
     unset($public_fields['self']);
     $public_fields['uuid'] = array('property' => 'uuid', 'methods' => array(RequestInterface::METHOD_GET));
     $public_fields['tags'] = array('property' => 'field_tags', 'referencedIdProperty' => 'name');
     $public_fields['body'] = array('property' => 'body', 'sub_property' => 'value');
     $public_fields['related'] = array('property' => 'field_related_content', 'referencedIdProperty' => 'uuid', 'resource' => array('name' => 'articles', 'majorVersion' => 3, 'minorVersion' => 0));
     $public_fields['heroImage'] = array('property' => 'field_image', 'referencedIdProperty' => 'uuid', 'resource' => array('name' => 'images', 'majorVersion' => 1, 'minorVersion' => 0));
     $public_fields['associatedPage'] = array('property' => 'field_associated_page', 'resource' => array('name' => 'pages', 'resource' => array('name' => 'pages', 'majorVersion' => 1, 'minorVersion' => 0)));
     $public_fields['slug'] = array('methods' => array(RequestInterface::METHOD_GET, RequestInterface::METHOD_OPTIONS), 'callback' => array($this, 'getUrlAlias'), 'discovery' => array('info' => array('label' => 'Slug', 'description' => 'URL alias according to pathauto.'), 'data' => array('type' => 'string', 'required' => FALSE, 'read_only' => TRUE, 'cardinality' => 1, 'size' => 255), 'form_element' => array()));
     return $public_fields;
 }
Пример #11
0
 /**
  * {@inheritdoc
  */
 protected function publicFields()
 {
     $public_fields = parent::publicFields();
     $public_fields['id']['methods'] = array();
     // Rename label to name;
     $public_fields['title'] = $public_fields['label'];
     unset($public_fields['label']);
     unset($public_fields['self']);
     unset($public_fields['links']);
     $public_fields['venue'] = array('property' => 'field_venue', 'resource' => array('name' => 'venues', 'full_view' => TRUE, 'majorVersion' => '1', 'minorVersion' => '2'));
     $public_fields['artists'] = array('property' => 'field_artists', 'resource' => array('name' => 'artists', 'majorVersion' => '1', 'minorVersion' => '2'));
     return $public_fields;
 }
Пример #12
0
 /**
  * {@inheritdoc}
  */
 protected function publicFields()
 {
     $public_fields = parent::publicFields();
     $public_fields['name'] = $public_fields['label'];
     unset($public_fields['label']);
     $public_fields['image'] = array('property' => 'field_image');
     $public_fields['phone'] = array('property' => 'field_phone');
     $public_fields['address'] = array('property' => 'field_address', 'formatter' => 'addressfield_default');
     $public_fields['location'] = array('property' => 'field_address');
     $public_fields['geo'] = array('property' => 'field_geo');
     $public_fields['social'] = array('property' => 'field_social');
     $public_fields['about'] = array('property' => 'field_about');
     $public_fields['url'] = array('wrapper_method' => 'value', 'wrapper_method_on_entity' => TRUE, 'process_callbacks' => array(array($this, 'uriProcess')));
     return $public_fields;
 }
 /**
  * Overrides ResourceNode::publicFields().
  */
 protected function publicFields()
 {
     $public_fields = parent::publicFields();
     $public_fields['body'] = array('property' => 'body', 'sub_property' => 'value');
     $public_fields['tags'] = array('property' => 'field_tags', 'resource' => array('name' => 'tags', 'majorVersion' => 1, 'minorVersion' => 0));
     $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('name' => 'users', 'fullView' => TRUE, 'majorVersion' => 1, 'minorVersion' => 0));
     $public_fields['static'] = array('callback' => '\\Drupal\\restful_example\\Plugin\\resource\\node\\article\\v1\\Articles__1_5::randomNumber');
     return $public_fields;
 }
Пример #14
0
 /**
  * {@inheritdoc
  */
 protected function publicFields()
 {
     $public_fields = parent::publicFields();
     $public_fields['id']['methods'] = array();
     // Rename label to name;
     $public_fields['title'] = $public_fields['label'];
     unset($public_fields['label']);
     unset($public_fields['self']);
     unset($public_fields['links']);
     $public_fields['date'] = array('property' => 'field_date', 'process_callbacks' => array(array($this, 'dateProcess')));
     $public_fields['url'] = array('wrapper_method' => 'value', 'wrapper_method_on_entity' => TRUE, 'process_callbacks' => array(array($this, 'uriProcess')));
     $public_fields['venue'] = array('property' => 'field_venue');
     $public_fields['artists'] = array('property' => 'field_artists', 'resource' => array('name' => 'artists', 'majorVersion' => '1', 'minorVersion' => '4'));
     return $public_fields;
 }
Пример #15
0
 /**
  * {@inheritdoc
  */
 protected function publicFields()
 {
     $public_fields = parent::publicFields();
     $public_fields['name'] = $public_fields['label'];
     unset($public_fields['label']);
     $public_fields['bundle'] = array('wrapper_method' => 'getBundle', 'wrapper_method_on_entity' => TRUE);
     $public_fields['address'] = array('property' => 'field_address');
     $public_fields['image'] = array('property' => 'field_image', 'process_callbacks' => array(array($this, 'imageUrl')));
     $public_fields['map'] = array('property' => 'field_geo', 'process_callbacks' => array(array($this, 'mapProcess')));
     $public_fields['mapLink'] = array('wrapper_method' => 'label', 'wrapper_method_on_entity' => TRUE, 'process_callbacks' => array(array($this, 'mapLinkProcess')));
     $public_fields['url'] = array('wrapper_method' => 'value', 'wrapper_method_on_entity' => TRUE, 'process_callbacks' => array(array($this, 'uriProcess')));
     $public_fields['phone'] = array('property' => 'field_phone');
     $public_fields['social'] = array('property' => 'field_social', 'process_callbacks' => array(array($this, 'socialProcess')));
     return $public_fields;
 }
 /**
  * Overrides ResourceNode::publicFields().
  */
 protected function publicFields()
 {
     $public_fields = parent::publicFields();
     $public_fields['body'] = array('property' => 'body', 'sub_property' => 'value');
     return $public_fields;
 }
 /**
  * {@inheritdoc}
  */
 protected function publicFields()
 {
     $fields = parent::publicFields();
     $fields['custom-uuid'] = array('methods' => array(), 'property' => 'uuid');
     return $fields;
 }