/**
  * {@inheritdoc}
  */
 protected static function checkPropertyAccess(ResourceFieldInterface $resource_field, $op, DataInterpreterInterface $interpreter)
 {
     $term = $interpreter->getWrapper()->value();
     if ($resource_field->getProperty() == 'name' && empty($term->tid) && $op == 'edit') {
         return TRUE;
     }
     return parent::checkPropertyAccess($resource_field, $op, $interpreter);
 }
 /**
  * {@inheritdoc}
  *
  * Almost all the defaults come are applied by the object's property defaults.
  */
 public function addDefaults()
 {
     // Set the defaults from the decorated.
     $this->setResource($this->decorated->getResource());
     // If entity metadata wrapper methods were used, then return the appropriate
     // entity property.
     if ($this->isWrapperMethodOnEntity() && $this->getWrapperMethod()) {
         $this->propertyOnEntity();
     }
     // Set the Entity related defaults.
     if (($this->property = $this->decorated->getProperty()) && ($field = $this::fieldInfoField($this->property)) && $field['type'] == 'image' && ($image_styles = $this->getImageStyles())) {
         // If it's an image check if we need to add image style processing.
         $process_callbacks = $this->getProcessCallbacks();
         array_unshift($process_callbacks, array(array($this, 'getImageUris'), array($image_styles)));
         $this->setProcessCallbacks($process_callbacks);
     }
 }
 /**
  * Get the (reference) field information for a single item.
  *
  * @param ResourceFieldInterface $resource_field
  *   The resource field.
  *
  * @throws \Drupal\restful\Exception\BadRequestException
  *
  * @return array
  *   An array containing the following keys:
  *   - 'name': Drupal's internal field name. Ex: field_article_related
  *   - 'type': Either a field or a property.
  *   - 'entity_type': The entity type this field points to. Not populated if
  *     the field is not a reference (for instance the destination field used
  *     in the where clause).
  *   - 'bundles': The allowed bundles for this field. Not populated if the
  *     field is not a reference (for instance the destination field used in
  *     the where clause).
  */
 protected function getFieldsFromPublicNameItem(ResourceFieldInterface $resource_field)
 {
     $property = $resource_field->getProperty();
     $resource = $resource_field->getResource();
     $item = array('name' => $property, 'type' => ResourceFieldEntity::propertyIsField($property) ? RelationalFilterInterface::TYPE_FIELD : RelationalFilterInterface::TYPE_PROPERTY, 'entity_type' => NULL, 'bundles' => array());
     $item['column'] = $item['type'] == RelationalFilterInterface::TYPE_FIELD ? $resource_field->getColumn() : NULL;
     $instance_id = sprintf('%s:%d.%d', $resource['name'], $resource['majorVersion'], $resource['minorVersion']);
     /* @var ResourceEntity $resource */
     $resource = restful()->getResourceManager()->getPluginCopy($instance_id, Request::create('', array(), RequestInterface::METHOD_GET));
     // Variables for the next iteration.
     $definitions = $resource->getFieldDefinitions();
     $item['entity_type'] = $resource->getEntityType();
     $item['bundles'] = $resource->getBundles();
     return array($item, $definitions);
 }
 /**
  * {@inheritdoc}
  */
 public function getProperty()
 {
     return $this->decorated->getProperty();
 }