/**
  * {@inheritdoc}
  */
 public function publicFields()
 {
     $public_fields = parent::publicFields();
     $public_fields['id']['methods'] = array();
     // Just return the hidden ID.
     return array('id' => $public_fields['id']);
 }
Exemplo n.º 2
0
 protected function publicFields()
 {
     $public_fields = parent::publicFields();
     $public_fields['link'] = array('property' => 'field_social_link');
     $public_fields['social_service'] = array('property' => 'field_social_service');
     return $public_fields;
 }
 /**
  * {@inheritdoc}
  */
 protected function publicFields()
 {
     $public_fields = parent::publicFields();
     $public_fields['main_bundle'] = array('property' => 'pid', 'class' => '\\Drupal\\restful\\Plugin\\resource\\Field\\ResourceFieldEntityReference', 'resource' => array('name' => 'main', 'majorVersion' => 1, 'minorVersion' => 0));
     $public_fields['tests_bundle'] = array('property' => 'pid', 'class' => '\\Drupal\\restful\\Plugin\\resource\\Field\\ResourceFieldEntityReference', 'resource' => array('name' => 'tests', 'majorVersion' => 1, 'minorVersion' => 0));
     return $public_fields;
 }
Exemplo n.º 4
0
 /**
  * {@inheritdoc
  */
 protected function publicFields()
 {
     $public_fields = parent::publicFields();
     $public_fields['name'] = $public_fields['label'];
     unset($public_fields['label']);
     $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();
     $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;
 }
 /**
  * {@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['url'] = array('property' => 'url');
     $image_styles = array('thumbnail', 'medium', 'large');
     $public_fields['styles'] = array('callback' => array(array($this, 'generateStyleUris'), array($image_styles)));
     return $public_fields;
 }
 /**
  * Overrides ResourceEntity::publicFields().
  *
  * @see http://tools.ietf.org/html/rfc6750#section-4
  */
 public function publicFields()
 {
     $public_fields = parent::publicFields();
     unset($public_fields['label']);
     unset($public_fields['self']);
     $public_fields['id']['methods'] = array();
     $public_fields['access_token'] = array('property' => 'token');
     $public_fields['type'] = array('callback' => array('\\Drupal\\restful\\RestfulManager::echoMessage', array('Bearer')));
     $public_fields['expires_in'] = array('property' => 'expire', 'process_callbacks' => array('\\Drupal\\restful_token_auth\\Plugin\\resource\\TokenAuthenticationBase::intervalInSeconds'));
     $public_fields['refresh_token'] = array('property' => 'refresh_token_reference', 'process_callbacks' => array('\\Drupal\\restful_token_auth\\Plugin\\resource\\TokenAuthenticationBase::getTokenFromEntity'));
     return $public_fields;
 }
 /**
  * {@inheritdoc}
  *
  * If "File entity" module exists, determine access by its provided
  * permissions otherwise, check if variable is set to allow anonymous users to
  * upload. Defaults to authenticated user.
  */
 public function access()
 {
     // The getAccount method may return an UnauthorizedException when an
     // authenticated user cannot be found. Since this is called from the access
     // callback, not from the page callback we need to catch the exception.
     try {
         $account = $this->getAccount();
     } catch (UnauthorizedException $e) {
         // If a user is not found then load the anonymous user to check
         // permissions.
         $account = drupal_anonymous_user();
     }
     if (module_exists('file_entity')) {
         return user_access('bypass file access', $account) || user_access('create files', $account);
     }
     return (variable_get('restful_file_upload_allow_anonymous_user', FALSE) || $account->uid) && parent::access();
 }
Exemplo n.º 9
0
 /**
  * {@inheritdoc}
  */
 protected function publicFields()
 {
     return array('type' => array('wrapper_method' => 'getBundle', 'wrapper_method_on_entity' => TRUE)) + parent::publicFields();
 }
Exemplo n.º 10
0
 protected function publicFields()
 {
     $public_fields = parent::publicFields();
     $public_fields['term'] = array('wrapper_method' => 'value', 'wrapper_method_on_entity' => TRUE, 'process_callbacks' => array(array($this, 'termProcess')));
     return $public_fields;
 }
Exemplo n.º 11
0
 /**
  * Overrides ResourceEntity::publicFields().
  */
 protected function publicFields()
 {
     $public_fields = parent::publicFields();
     $public_fields['process_callbacks'] = array('wrapper_method' => 'label', 'wrapper_method_on_entity' => TRUE, 'process_callbacks' => array(array($this, 'invalidProcessCallback')));
     return $public_fields;
 }