function message_type_delete has a wrong explanation: message -> message type OR
There's a misconsistency in object and id:

It is:

/**
 * Deletes an existing message.
 *
 * @param $message
 *   The message object to be deleted.
 */
function message_type_delete($message) {
  return entity_delete('message_type', $message);
}

It should be:

/**
 * Deletes an existing message type.
 *
 * @param $message_id
 *   The message type object id to be deleted.
 */
function message_type_delete($message) {
  return entity_delete('message_type', $message);
}

OR:

/**
 * Deletes an existing message type.
 *
 * @param $message
 *   The message type object to be deleted.
 */
function message_type_delete($message) {
  return entity_delete('message_type', $message->id);
}

I believe the second one is a better way as you can use function message_type_load() to load the message type object and you just pass this object into function message_type_delete().

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

bsandor’s picture

Issue summary: View changes
bsandor’s picture

Issue summary: View changes
bsandor’s picture

Issue summary: View changes
bsandor’s picture

Issue summary: View changes
bsandor’s picture

jacob.embree’s picture

Version: 7.x-1.9 » 7.x-1.x-dev
Status: Active » Needs review
FileSize
599 bytes

Entity delete functions normally expect the entity identifier as the parameter. Here is a patch to fix the documentation and parameter name but leaves the functionality the same.

karuna patel’s picture

Status: Needs review » Reviewed & tested by the community
FileSize
597 bytes

#6 patch worked for me, I have updated documentation and parameter in patch.

karuna patel’s picture

Status: Reviewed & tested by the community » Needs review
Dinesh18’s picture

Status: Needs review » Reviewed & tested by the community

Looks good to me. +1 to RTBC

jacob.embree’s picture

I think the patch in #6 is better than the patch in #7 because #6 makes it more clear what the nature of the parameter must be.

bluegeek9’s picture

Status: Reviewed & tested by the community » Closed (outdated)