Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hello,
I am facing given below error while delete the OG.
Call to undefined method EntityValueWrapper::getBundle()
When i disabled the og_vocab module or comment the "og_vocab_entity_delete" function the OG will deleted successfully.
Comment | File | Size | Author |
---|---|---|---|
#4 | reference_drupal_static-2160415-4.patch | 501 bytes | ulethjay |
Comments
Comment #1
RoySegall CreditAttribution: RoySegall commentedDid you mean when you delete a group you get this error?
Comment #2
RoySegall CreditAttribution: RoySegall commentedWe had the same problem in OS yesterday. Do you have the redirect module enable?
Comment #3
kulbhushan CreditAttribution: kulbhushan commentedHi
I had the same problem facing while deleting the og. Give below is code for solving this issue.
function hook_vocab_entity_info_alter(&$entity_info) {
$entity_info['og_vocab']['uri callback'] = 'hook_og_vocab_uri';
}
function hook_og_vocab_uri($og_vocab) {
$url = array();
$vocab = taxonomy_vocabulary_load($og_vocab->vid);
if (user_access('administer taxonomy') && is_object($vocab)) {
// URL to taxonomy administration.
$url = array(
'path' => "admin/structure/taxonomy/$vocab->machine_name/edit",
);
} else {
$relation = og_vocab_relation_get($og_vocab->vid);
if (is_object($relation)) {
if (og_user_access($relation->group_type, $relation->gid, 'administer taxonomy')) {
// URL to taxonomy administration in the group context.
$url = array(
'path' => "group/$relation->group_type/$relation->gid/admin/taxonomy/$vocab->machine_name/edit",
);
}
}
}
if (count($url)) {
$entity_type = $og_vocab->entity_type;
$bundle = $og_vocab->bundle;
$url['options']['fragment'] = drupal_clean_css_identifier("og-vocab-$entity_type-$bundle");
}
return $url;
}
Comment #4
ulethjay CreditAttribution: ulethjay commentedI realize this is incredibly old, but in the event someone else runs into this issue...
I too had the redirect module installed, though that is not really the issue.
When deleting a vocabulary
og_vocab_entity_delete
runs its course leading toog_vocab_relation_get
. This function queries the database and stores the result viadrupal_static
.Later in the process
redirect_entity_delete
comes along, makes its way toog_vocab_relation_get
, and fails twice to retrieve the same data.The first failure occurs because
drupal_static
isn't called by reference, leading$cache
to be empty on the second pass.The second failure I don't fully understand, but despite running the same query as before,
db_select
produces zero results the second time.Having said all that, I might be beneficial for
og_is_group
, etc, to ensure they aren't trying to put an entity wrapper around aNULL
.Fatal Error!?! Meh, worked for me. Just change
drupal_static
to&drupal_static
inog_vocab_relation_get
Comment #5
amitaibuNice catch, lets see what testbot thinks of it :)