You are here

protected function RestfulEntityBaseTaxonomyTerm::checkPropertyAccess in RESTful 7

Overrides \RestfulEntityBase::checkPropertyAccess().

Allow user to create a label for the unsaved term, even if the user doesn't have access to update existing terms, as required by the entity metadata wrapper's access check.

Overrides RestfulEntityBase::checkPropertyAccess

File

plugins/restful/RestfulEntityBaseTaxonomyTerm.php, line 38
Contains RestfulEntityBaseTaxonomyTerm.

Class

RestfulEntityBaseTaxonomyTerm
A base implementation for "Taxonomy term" entity type.

Code

protected function checkPropertyAccess($op, $public_field_name, EntityMetadataWrapper $property, EntityMetadataWrapper $wrapper) {
  $info = $property
    ->info();
  $term = $wrapper
    ->value();
  if (!empty($info['name']) && $info['name'] == 'name' && empty($term->tid) && $op == 'edit') {
    return TRUE;
  }
  return parent::checkPropertyAccess($op, $public_field_name, $property, $wrapper);
}