Created
May 5, 2015 10:28
-
-
Save HelenaEksler/d9d7dad3dd9010e5b9c5 to your computer and use it in GitHub Desktop.
checkPropertyAccess()
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Overrides \RestfulEntityBaseTaxonomyTerm::checkPropertyAccess(). | |
* | |
* Allow user to set the parent term 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. | |
*/ | |
protected function checkPropertyAccess($op, $public_field_name, EntityMetadataWrapper $property, EntityMetadataWrapper $wrapper) { | |
$info = $property->info(); | |
$term = $wrapper->value(); | |
if (!empty($info['name']) && $info['name'] == 'parent' && empty($term->tid) && $op == 'edit') { | |
return TRUE; | |
} | |
return parent::checkPropertyAccess($op, $public_field_name, $property, $wrapper); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment