You are here

function _ad_create in Advertisement 7.2

Creation callback for the Entity Metadata module.

1 string reference to '_ad_create'
ad_entity_info in ./ad.module
Implements hook_entity_info().

File

./ad.module, line 276
Defines the core ad entity, including the entity itself, the bundle definitions (ad types), and various API functions to manage ads and interact with them through forms and autocompletes.

Code

function _ad_create($values = array()) {

  // Create a new ad of the specified type.
  $ad = ad_create($values['type']);
  unset($values['type']);
  $wrapper = entity_metadata_wrapper('ad', $ad);
  foreach ($values as $name => $value) {
    $wrapper->{$name}
      ->set($value);
  }
  return $wrapper;
}