function entity_extract_ids

cis7 entity_extract_ids($entity_type, $entity)
cle7 entity_extract_ids($entity_type, $entity)
elmsmedia7 entity_extract_ids($entity_type, $entity)
icor7 entity_extract_ids($entity_type, $entity)
meedjum_blog7 entity_extract_ids($entity_type, $entity)
mooc7 entity_extract_ids($entity_type, $entity)

Helper function to extract id, vid, and bundle name from an entity.


$entity_type: The entity type; e.g. 'node' or 'user'.

$entity: The entity from which to extract values.

Return value

A numerically indexed array (not a hash table) containing these elements:

  • 0: Primary ID of the entity.
  • 1: Revision ID of the entity, or NULL if $entity_type is not versioned.
  • 2: Bundle name of the entity, or NULL if $entity_type has no bundles.
148 calls to entity_extract_ids()
better_formats_filter_process_format in sites/all/modules/ulmus/better_formats/better_formats.module
Process callback for form elements that have a text format selector attached.
ctools_context_create_entity in sites/all/modules/ulmus/ctools/plugins/contexts/
It's important to remember that $conf is optional here, because contexts are not always created from the UI.
ctools_context_entity_settings_form_validate in sites/all/modules/ulmus/ctools/plugins/contexts/
Validate a node.
ctools_entity_field_content_type_render in sites/all/modules/ulmus/ctools/plugins/content_types/entity_context/
Render the custom content type.
ctools_entity_field_extra_content_type_render in sites/all/modules/ulmus/ctools/plugins/content_types/entity_context/
Render the extra field.

... See full list


includes/, line 7711
Common functions that many Drupal modules will need to reference.


function entity_extract_ids($entity_type, $entity) {
  $info = entity_get_info($entity_type);

  // Objects being created might not have id/vid yet.
  $id = isset($entity->{$info['entity keys']['id']}) ? $entity->{$info['entity keys']['id']} : NULL;
  $vid = ($info['entity keys']['revision'] && isset($entity->{$info['entity keys']['revision']})) ? $entity->{$info['entity keys']['revision']} : NULL;

  if (!empty($info['entity keys']['bundle'])) {
    // Explicitly fail for malformed entities missing the bundle property.
    if (!isset($entity->{$info['entity keys']['bundle']}) || $entity->{$info['entity keys']['bundle']} === '') {
      throw new EntityMalformedException(t('Missing bundle property on entity of type @entity_type.', array('@entity_type' => $entity_type)));
    $bundle = $entity->{$info['entity keys']['bundle']};
  else {
    // The entity type provides no bundle key: assume a single bundle, named
    // after the entity type.
    $bundle = $entity_type;

  return array($id, $vid, $bundle);



Error message

  • Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/elmsln_community/ in drupal_send_headers() (line 1499 of /var/www/html/elmsln_community/
  • Error: Call to undefined function apc_delete() in DrupalAPCCache->clear() (line 289 of /var/www/html/elmsln_community/
The website encountered an unexpected error. Please try again later.